2
var num = 1;
typeof num;  //prints number
console.log(num.__proto__); //prints Number
console.log(num.__proto__.__proto__); //prints Object

When variable num is behaving like a typical Object then why number is called primitive in javascript?

Mangoose
  • 922
  • 1
  • 9
  • 17
  • 3
    To summarize the answer from these other questions: Primitives are automatically put into their appropriate wrappers (in this case, `Number`) when you use them like objects. – Chris Martin Dec 22 '16 at 18:39

0 Answers0