For both,
var num1 = new Number(34);
num2 = 34;
You are assigning "Number"
type values to both num1
and num2
variables. So it calls the prototype, which attached to the "Number"
.
But calling 34.sayMyNumber
has syntax error and its an illegal statement.
If anyone has question on this please refer... https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number