-
-
Save vestigegroup/79a4641fc81d3a4256abb9279cab10e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let obj1 = { | |
a: "this", | |
b: "is", | |
c: "an", | |
d: "object", | |
e: "literal" | |
}; | |
let obj2 = new Object(["object", "contructor", "one"]); // new Array("", "", "") | |
let obj3 = new Object({ an: "object", literal: "again" }); | |
let obj4 = new Object(obj1.a); // new Object("some string") new String("asdfas") | |
let obj5 = new Object(); //same as new Object(null) or new Object(undefined) | |
let obj6 = new Object(true); // new Boolean(true) | |
console.log( | |
"OBJ1", | |
obj1, | |
typeof obj1, | |
obj1 instanceof Object, | |
obj1.constructor, | |
"\n" | |
); | |
console.log( | |
"OBJ2", | |
obj2, | |
typeof obj2, | |
obj2 instanceof Array, | |
obj2 instanceof Object, | |
Array.isArray(obj2), | |
obj2.constructor, | |
"\n" | |
); | |
console.log( | |
"OBJ3", | |
obj3, | |
typeof obj3, | |
obj3 instanceof Object, | |
obj3.constructor, | |
"\n" | |
); | |
console.log( | |
"OBJ4", | |
obj4, | |
typeof obj4, | |
obj4 instanceof String, | |
obj4.constructor, | |
"\n" | |
); | |
console.log( | |
"steve", | |
String("steve"), | |
new String("steve"), | |
typeof "steve", | |
typeof String("steve"), | |
typeof new String("steve"), | |
"\n" | |
); | |
console.log( | |
"OBJ5", | |
obj5, | |
typeof obj5, | |
obj5 instanceof Object, | |
obj5.constructor, | |
"\n" | |
); | |
console.log( | |
"OBJ6", | |
obj6, | |
typeof obj6, | |
obj6 instanceof Boolean, | |
obj6 instanceof Object, | |
obj6.constructor, | |
"\n" | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment