File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ This page created for javascript beginner programmers to show not obvious behavi
44
55* [ Assigment Anomaly] ( #assigment-anomaly )
66* [ Reference Anomaly] ( #reference-anomaly )
7+ * [ New Anomaly] ( #new-anomaly )
78* [ Closure Anomaly] ( #closure-anomaly )
89* [ Delete Anomaly] ( #delete-anomaly )
910* [ Type Anomaly] ( #type-anomaly )
@@ -52,6 +53,32 @@ console.log(a.value);
5253// output: 2
5354```
5455
56+ ### New Anomaly
57+
58+ ```
59+ var myClass = function() {
60+ this.a = 1;
61+ this.b = 2;
62+ };
63+
64+ var myClass2 = function() {
65+ this.a = 1;
66+ this.b = 2;
67+
68+ return {
69+ a: 2
70+ };
71+ };
72+
73+ var myObject = new myClass();
74+ var myObject2 = new myClass2();
75+
76+ console.log(typeof myObject.b);
77+ // output: number
78+ console.log(typeof myObject2.b);
79+ // output: undefined
80+ ```
81+
5582### Closure Anomaly
5683```
5784for (var i = 0; i < 3; i++) {
You can’t perform that action at this time.
0 commit comments