loading...

re: Kyle Simpson proved I STILL don't know JavaScript (arrays) VIEW POST

FULL DISCUSSION
 

I think this actually makes perfect sense if you actually take a look at the
documentation. When you set something to undefined you are initializing it. So while it is still undefined its not the same as uninitialized. Array.forEach isn't invoked on uninitialized values and for... in(which you shouldn't use with arrays anyways) does something similar(more specifically it will loop over enumerable properties). What you are referring to as implicitly undefined and explicitly undefined is largely just initialized and not initialized.

 

You are absolutely right on all points (and that's really what I was getting to).

The behavior makes sense once you break down what's actually going on (as is almost always the case with JavaScript)

And yeas, "implicitly undefined" and "explicitly undefined" could also be called "uninitialized" and "initialized". Though I like implicit/explicit because it suggests intent a bit more clearly.

code of conduct - report abuse