A very simple doubt about Objects

I was reading the documentation in w3. And they says at the end of this link:
"Do Not Declare Strings, Numbers, and Booleans as Objects!"

So it’s wrong this code? Or they are referring to another thing? I’m not quite sure.

Your code is fine, you’re declaring your own Object. This warning reffers only to these three statements
var x = new String(); // Declares x as a String object var y = new Number(); // Declares y as a Number object var z = new Boolean(); // Declares z as a Boolean object

1 Like

Aaah! Everything it’s clear now. Thanks Maciej!! :wink: