I am trying to wrap my head around javascript prototype inheritance and, while reading John Resig's book "About Javascript Techniques", I have tried these things:
alert("me".constructor); //Correctly return String
alert(alert.constructor); //Correctly return Function
However
alert(55.constructor);//I was expecting Number, but it returns error "SyntaxError: identifier starts immediately after numeric literal" in FF and in IE, it says it is expecting ")"
I also tried other functions that should work on a number, for example toFixed() toPrecision(), even toString(), but nothing works!
Can someone explain this behavior?
source
share