Created
September 19, 2019 20:40
-
-
Save djD-REK/7cb92242050403b3d42bc1638aa85962 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const primitiveString = `Hello world!` // primitive type string | |
const wrappedString = new String(`Hello world!`) // wrapper object | |
console.log(typeof primitiveString) // "string" | |
console.log(typeof wrappedString) // "object" | |
console.log(primitiveString == wrappedString) // true | |
console.log(primitiveString === wrappedString) // false | |
const almostWrappedString = String(`Hello world!`) // wrapper called without new | |
console.log(typeof almostWrappedString) // "string" | |
console.log(primitiveString === almostWrappedString) // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment