Why calling syntax of string methods differs of calling number methods


#1

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


#2

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.


#3

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