var num1 = new Number(5);
typeof(num1); //returns "object"
num1.toString(); //returns "5"
I understand that num1 being an object has a property .__proto__ via which it gets access to .toString() by going down the prototype (.__proto__) chain.
var num = 5;
typeof(num); //returns "number"
num.toString(); //returns "5"
In above case, num is a primitive type number. It means that it won't have any properties and methods. Then how's it able to get access to .toString() method?