|
|
|
|
|
by baron816
1649 days ago
|
|
There really isn’t, and that’s what the OP is saying. But this is worth knowing about: `true` in Javascript is a primitive, so it doesn’t have any methods on it—it’s just a simple value. But you can do `true.toString()` in JS. How? The engine will automatically convert the primitive to an object so that you get those methods. It’s less useful for booleans, but strings obviously have lots of useful methods that you’d want to use with the actual underlying primitive values. But yeah, since the language does it automatically for you, you should never do something like `new Boolean(true)`, or `new String(‘hello world’)`. The objects are created when you need them and cleaned up when you don’t. |
|