|
|
|
|
|
by mudetroit
4862 days ago
|
|
I find some of these thoughts to be be a bit off in their basic premise. For example, "A function is a function. A class is a function. An anonymous method is a function." Well There are no classes in javascript at all. A constructor is a function in most OO languages. The difference here is the underlying OO implementation. Anonymous methods are by nature functions as well. Could there be a more succinct syntax for them? Perhaps, but of all of the complaints about javascript this is a relatively minor one. I would never say that there are not things about JS that don't drive me nuts. But the relatively simplicity of thinking of just about everything being treated equally from a language standpoint gives you a flexibility to work that can be really refreshing. |
|
The everything is a function is because at least in other languages it's clear what a constructor is, what a function is and what an anonymous method is. They all look distinctly different and have different keywords or declaration syntax. Generally speaking something like:
Visually they are very different. In javascript they all look pretty much the same and have exactly the same syntax.