DEV Community

Discussion on: (Not) Everything in JavaScript is an Object

 
bl41r profile image
David Smith • Edited

I think you forgot the new keyword:

y = "string"
"string"
x = new String("string")
String {0: "s", 1: "t", 2: "r", 3: "i", 4: "n", 5: "g", length: 6, [[PrimitiveValue]]: "string"}
x === y
false
String("string") === "string"
true
new String("string") === "string"
false
typeof(x)
"object"
typeof(y)
"string"
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
samuraiseoul profile image
Sophie The Lionhart

That's most likely it. You're far more knowledgeable than me in this area it seems. Thanks for adding the clarity for future readers and teaching me something!