Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
gitreflog3270339dif you can do something like new Array(20) to create an array with 20 undefined i would understand it since then arr.length is 20..
ChachiKlaus2325339d@romangraef ahhh. Great point.
C0D427859339dnot JS, but I know a PHP dev who does this
And then every array key after it is
$arr = ;
$arr[“key1”] = 123;
$arr[“key2”] = 456;
And so on 🤦♂️🔫
$arr = array(“key1” => 123, “key2” => 456);
Froot8661339d@romangraef True, but if you map over it and expect to get 20 results back you'll be disappointed 😄
(new Array(20)).fill(0).map(x => "woop woop")
is what you need if you want that sort of thing 😄
ChachiKlaus2325339dWow. Yeah that's just. Wow. Does he at least get paid per line lmao?
AlgoRythm36052339dThe first one should be quicker, as it doesn't require a name lookup
Kekica1057339dMy preffered way is with  but I dont really care if someone is using constructor. People are making more fked up things in js than this.
Your Job Suck?
Take a quick quiz from Triplebyte to skip the job search hassles and jump to final interviews at hot tech firms
Get a Better Job