Why calling syntax of string methods differs of calling number methods


Eg: it is possible to call “someString”.method(), but is not possible 111.method() and only Number.method(111) allowed?


Design choices by whomever made JavaScript language. Not that there went a lot of thought into JS, it was build in 10 days (which is very little)

if we look at other language like ruby and python, calling method is possible on integers. But its more important to understand how things are implemented then why they are implemented that way, you can learn that later.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.