Ask Lemmy
A Fediverse community for open-ended, thought provoking questions
Please don't post about US Politics. If you need to do this, try [email protected]
Rules: (interactive)
1) Be nice and; have fun
Doxxing, trolling, sealioning, racism, and toxicity are not welcomed in AskLemmy. Remember what your mother said: if you can't say something nice, don't say anything at all. In addition, the site-wide Lemmy.world terms of service also apply here. Please familiarize yourself with them
2) All posts must end with a '?'
This is sort of like Jeopardy. Please phrase all post titles in the form of a proper question ending with ?
3) No spam
Please do not flood the community with nonsense. Actual suspected spammers will be banned on site. No astroturfing.
4) NSFW is okay, within reason
Just remember to tag posts with either a content warning or a [NSFW] tag. Overtly sexual posts are not allowed, please direct them to either [email protected] or [email protected].
NSFW comments should be restricted to posts tagged [NSFW].
5) This is not a support community.
It is not a place for 'how do I?', type questions.
If you have any questions regarding the site itself or would like to report a community, please direct them to Lemmy.world Support or email [email protected]. For other questions check our partnered communities list, or use the search function.
Reminder: The terms of service apply here too.
Partnered Communities:
Logo design credit goes to: tubbadu
view the rest of the comments
Javascript arrays begin empty, even when sized, and in a way that's different from NaN. If you do
new Array(12).map( (value, index) => index )
to get a counting list, you get... nothing..map()
does not iterate over those indices. But if you donew Array(12).fill(0).map( (value, index) => index )
then it works..fill()
does iterate over those values. Why? Because screw you, that's why.If you examine the empty array in the console, it reports "12 empty slots," and all values come back as "undefined." But if you pass it through JSON.stringify, those all become nulls. Why aren't they nulls in the first place? See previous answer.
Never done anything with javascript, but it sounds like a lot of fun, just like writing VBA in Excel. You know, there’s a reason why I tend to move my calculations to R as soon I can see that Excel is about to consider giving me headaches.