Skip to content

Commit 388abf6

Browse files
authored
Add new anomaly
1 parent af51be9 commit 388abf6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff 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
```
5784
for (var i = 0; i < 3; i++) {

0 commit comments

Comments
 (0)