by asdf-asdf-asdf · 6y ago · 0 comments
there are other similar problems in javascript too:
- "typeof null === 'object'". this is very wrong, but again,this is how it was implemented at the beginning... you know the rest ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... )
- another problem with ".sort()" is that it both mutates the input-array and returns the mutated input-array. so you write code like "const arr2 = arr1.sort()", and the code works, but if you don't know the spec, you will not know that "arr1" was modified and basically "arr1 === arr2".