Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 404d2ca + 552ba56 commit 032000fCopy full SHA for 032000f
literals-and-constructors/primitive-wrappers.html
@@ -37,14 +37,13 @@
37
// but it doesn't actually work
38
console.log(typeof greet.smile); // "undefined"
39
40
- // primitive string
+ // primitive wrapper
41
var greet = new String("Hello there");
42
- // primitive is converted to an object
43
- // in order to use the split() method
+ // split() method is called directly on the object
44
greet.split(' ')[0]; // "Hello"
45
- // attemting to augment a primitive is not an error
+ // augment the object
46
greet.smile = true;
47
- // but it doesn't actually work
+ // it works
48
console.log(typeof greet.smile); // "boolean"
49
50
0 commit comments