this post was submitted on 29 Sep 2023
143 points (97.4% liked)

Ask Lemmy

27006 readers
1235 users here now

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 funDoxxing, 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 spamPlease do not flood the community with nonsense. Actual suspected spammers will be banned on site. No astroturfing.


4) NSFW is okay, within reasonJust 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:

Tech Support

No Stupid Questions

You Should Know

Reddit

Jokes

Ask Ouija


Logo design credit goes to: tubbadu


founded 1 year ago
MODERATORS
 

Loosely inspired by how much people seemed to enjoy a similar question I asked on Games about unappreciated titles. But answers don't have to be media related (they still can be though).

you are viewing a single comment's thread
view the rest of the comments
[–] mindbleach 2 points 1 year ago (1 children)

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 do new 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.

[–] [email protected] 2 points 1 year ago

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.