Re:Common JavaScript Gotchas
by mattmanser on Sunday February 24, 2013 @08:01AM
(#5274042)
The relative simplicity is what I mean about really enjoying writing javascript.
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:
class Thing
Thing() { } //constructor
function Thing() {} //function
(p) => {} //anonymous method
Visually they are very different. In javascript they all look pretty much the same and have exactly the same syntax.
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.