New Features in ES2019
javascript.christmas
New Features in ES2019
1–10 of 123 posts
Re: New Features in ES2019
#2Re: New Features in ES2019
#3Like I wonder how many bugs were introduced because the developer didn’t realize Array.sort() was unstable.
Re: New Features in ES2019
#4Re: New Features in ES2019
#5I don’t mean to hate on ECMAScript, but is anyone else slightly surprised these features weren’t in earlier? Like I wonder how many bugs were introduced because the developer didn’t realize Array.sort() was unstable.
[1,2,10].sort()
= [1,10,2]Re: New Features in ES2019
#6I don’t mean to hate on ECMAScript, but is anyone else slightly surprised these features weren’t in earlier? Like I wonder how many bugs were introduced because the developer didn’t realize Array.sort() was unstable.
Another sort() quirk that catches people out is not realising it uses string comparison by default [1,2,10].sort() = [1,10,2]
Re: New Features in ES2019
#7I don’t mean to hate on ECMAScript, but is anyone else slightly surprised these features weren’t in earlier? Like I wonder how many bugs were introduced because the developer didn’t realize Array.sort() was unstable.
Another sort() quirk that catches people out is not realising it uses string comparison by default [1,2,10].sort() = [1,10,2]
Hell, really?? That's gross.
As for the parent's comment about a dev "not realising array.sort() was unstable", the dev should know his tools. I can't see anyway why a stable sort is better, I've never sorted on x then sorted on x, you just sort on x & y.
Re: New Features in ES2019
#8I wonder what kind of shenanigans you could do with Function.toString(). It'd be even better if they had Function.toAST().
Re: New Features in ES2019
#9I wonder what kind of shenanigans you could do with Function.toString(). It'd be even better if they had Function.toAST().
Re: New Features in ES2019
#10I don’t mean to hate on ECMAScript, but is anyone else slightly surprised these features weren’t in earlier? Like I wonder how many bugs were introduced because the developer didn’t realize Array.sort() was unstable.
Another sort() quirk that catches people out is not realising it uses string comparison by default [1,2,10].sort() = [1,10,2]
If the comparison function argument was mandatory in sort() this wouldn’t be a problem.