return array('a', 'b');
print foo(); // SYNTAX ERROR. Intermediate variable required.
return ['a', 'b'];
alert(foo()); // Of course this works!
The difference in levels of crazy is impossible to under-emphasize!
There are a lot worse languages than JS. PHP is inescapably broken and thoroughly unsalvageable without creating what is effectively a brand new language. All JS needs is typing, a package or module system, and maybe some improvements to its standard library. Its other flaws are no more serious than those of pick-your-favorite-language.
The main issue with JS is that for a long time serious programmers ignored it and as a result it was only used by the ignorant and the short sighted. The second worst problem with JS is the DOM, which really has nothing to do with it. The third is that a lack of packages has made large and inter-connected JS code pointlessly painful. I fail to see what of any of this is as intractable as PHP's broken type system, broken object system, broken parser, etc., etc..
So, please, bash JS all you like, but don't be vulgar and bring PHP in to it.
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds