Message from JavaScript discussions
September 2017
— Currently my iterator only skips undefined
regardless, which is bad
So I need to be able to tell this:
var arr = [];
arr[50] = "hello world";
From this:
var arr = [];
arr[49] = undefined;
arr[50] = "hello world";
— Currently I don't know of a way to tell these two arrays apart
— Other than using a for...in
loop or other discrete builtin
— Here is how I currently do it: https://github.com/Floofies/Differentia.js/blob/master/src/differentia.js#L147
— It does not tell those two arrays apart and correctly iterate the assigned index 49
— The problem is hasOwnProperty
is slow on objects, but what about Arrays? Maybe index in arr
is faster
— Oki guys, a question for you without looking up the reason.
null > 0 //false
null === 0 //false
null >= 0 //true
Why
— Coercion, null coerces to false and false coerces to 0, that gives answer to 1 and 3
— === checks value as well as type
— Null == 0 is false as well.
— null == 0
but typeof null != typeof 0
,
Edit: null != 0