Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
gitreflog3142245dif 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..
ChachiKlaus2345245d@romangraef ahhh. Great point.
C0D423410245dnot 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);
Froot8758245d@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 😄
ChachiKlaus2345245dWow. Yeah that's just. Wow. Does he at least get paid per line lmao?
AlgoRythm32442245dThe first one should be quicker, as it doesn't require a name lookup
Kekica910245dMy 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