|
|
|
|
|
by sonnyblarney
2828 days ago
|
|
"We fully embrace Javascript as dynamically typed language" Ok, but why? Do you not think there's an advantage in having a difference between strings and numbers? "1" == 1? You can chose that if you want, surely, but what are the advantages of 'embracing' this? |
|
For example in Node.JS callback convention the last argument is always the callback functions, even if the function takes 4 arguments, you can put the callback in the 3:rd argument and it will figure out which one is the callback function. Then the first parameter in the callback function is either null or an Error.
Another example is RegeExp where you can write if( str.match(/foo/) ) instead of if ( str.match(foo) === null )
It's also convenient that empty strings are "falsy" which allow you to write if(!foo) instead of if( foo==="" || foo===undefined || foo===0 )