4 ms·
Everything looks great, other than the fact I'm still forced to use a broken language to interact with shiny new APIs: https://gist.github.com/4471029 https://
by hcarvalhoalves 14y ago
Everything looks great, other than the fact I'm still forced to use a broken language to interact with shiny new APIs:
https://gist.github.com/4471029 https://gist.github.com/4471029
Then you want me to manipulate binary data with an array implementation this crappy?
- reaclmbs 14y agoArrays in JavaScript are instances of the Array object Two different instances are not equal to each other
- hcarvalhoalves 14y agoYes, I get the idiossincracies. Triple equal operator also returns false. What I don't get is how is it acceptable this language has the largest installed base in the world and you have to write boilerplate just to equality test two arrays.
- mayanksinghal 14y ago> how is it acceptable? Because developers feel that it is and have done so in past. Because things that required and unavailable have been put down in libraries that developers can import and utilize. Because there are many libraries that compete against each other to provide better interfaces for their users. Because they are used very widely and very successfully. Because it's simplicity has made it usable among the masses who may not have otherwise participated in content creation on the web if CS101 was a requirement. Because its benefits have outweighed its faults. Because when people suggest alternatives (Dart?) they realize that they need to make them compatible with JS because it is not only popular but also quite efficient now.
- shimms 14y agoSo it uses lexicographic sort by default, just pass a custom comparator no? https://gist.github.com/4471254 https://gist.github.com/4471254
- md224 14y agoor if he doesn't even feel like passing a custom comparator every time and just wants to default to increasing numerical order: (function(){var a=function(a,b){return a>b},b=Array.prototype.sort;Array.prototype.sort=function(){return b.call(this,a)}})();
- hcarvalhoalves 14y agoI'm aware of the solution. What I'm disputing is why sort does the least obvious, stupidest thing I can think about by default - specially since numerical is equivalent to alphabetical for the ASCII set.