Internal Link 3

The following text is an excerpt from Kyle Simpson’s “You don’t know JS” and is intended here for SEO experiments only.

There are some gotchas with using the object wrappers directly that you should be aware of if you do choose to ever use them.

For example, consider Boolean wrapped values:

The problem is that you’ve created an object wrapper around the false value, but objects themselves are “truthy” (see Chapter 4), so using the object behaves oppositely to using the underlying false value itself, which is quite contrary to normal expectation.

If you want to manually box a primitive value, you can use the Object(..) function (no new keyword):

Again, using the boxed object wrapper directly (like b and c above) is usually discouraged, but there may be some rare occasions you’ll run into where they may be useful.