-1

If I set the prototype to null, then how come I can still use toString on the object?

var nakedObject=Object.create(null,{
name:{
    configurable:true,
    enumerable:true,
    value:"Hello",
    writable:true
}
});
 console.log(nakedObject.name.toString());
 console.log ("valueOf" in nakedObject);
akotch
  • 215
  • 5
  • 11

1 Answers1

1

The nakedObject doesn't have a prototype anymore, but the property .name still does. And because you assigned it the value "Hello" it is a String, therefore it has the String prototype.

Sebastian Speitel
  • 7,166
  • 2
  • 19
  • 38