Cofounded Host Collective (DiscountASP.net). Cofounded Player Axis (Social Gaming). Computer Scientist and Technology Evangelist with 20+ years of experience with JavaScript!
For a "complete guide" I would have liked to see exceptions, this, closures, arrow syntax, async, argument destructuring, default values, and even maybe partial application (bind/call/apply) to have been covered.
Cofounded Host Collective (DiscountASP.net). Cofounded Player Axis (Social Gaming). Computer Scientist and Technology Evangelist with 20+ years of experience with JavaScript!
There are two ways to exit a function, one is to return a value, the other is to throw an exception.
Exceptions are a (valid) type of output that a function can produce. When you document a function that you have created, let's say for a public library, you should document the argument (inputs) the return value (output) as well as the types of exceptions that may be thrown.
An example of this can be seen here: msdn.microsoft.com/en-us/library/y.... The Math.DivRem method has documented two possible results the function will produce, either a System.Int32 or a DivideByZeroException.
If a programmer does not treat (and handle) exceptions as a possible (and valid) function result they are are putting themselves at risk of authoring buggy software.
For a "complete guide" I would have liked to see exceptions,
this
, closures, arrow syntax, async, argument destructuring, default values, and even maybe partial application (bind/call/apply) to have been covered.I don't see why Exceptions should be in a "Function - Complete Guide". Closure would fit, though...
There are two ways to exit a function, one is to return a value, the other is to throw an exception.
Exceptions are a (valid) type of output that a function can produce. When you document a function that you have created, let's say for a public library, you should document the argument (inputs) the return value (output) as well as the types of exceptions that may be thrown.
An example of this can be seen here: msdn.microsoft.com/en-us/library/y.... The Math.DivRem method has documented two possible results the function will produce, either a System.Int32 or a
DivideByZeroException
.If a programmer does not treat (and handle) exceptions as a possible (and valid) function result they are are putting themselves at risk of authoring buggy software.
Good point man.
I surrender :D
I will cover ES6 stuff in another article :D