An array of ways ... to create arrays (JS Basics)

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ก.ค. 2024
  • Even in 2024, creating arrays in JavaScript has a few gotchas that you'll want to know about! And don't let sparse arrays catch you off guard!
    My Links
    shaky.sh
    shaky.sh/tools
    #programming #coding #typescript #javascript #frontenddeveloper #backenddeveloper #softwareengineer #softwareengineering #softwaredevelopment #javascriptbasics
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 14

  • @mk72v2oq
    @mk72v2oq 13 วันที่ผ่านมา +7

    The real benefit of 'Array.from({ length: 5 }, (i) => { ... })' is that it doesn't allocate an intermediate array to map on. This could lead to significant performance improvement, especially on large arrays.

  • @AfonsoSantos-dx2hq
    @AfonsoSantos-dx2hq 13 วันที่ผ่านมา +1

    Really enjoyed watching, would love more javascript basics videos like this one

  • @krzysztofprzybylski2750
    @krzysztofprzybylski2750 13 วันที่ผ่านมา +2

    As much as I like js I feel like sparse arrays were created as a gotcha for developers young and old.

  • @Fullflexno
    @Fullflexno 8 วันที่ผ่านมา

    Supercool!

  • @krccmsitp2884
    @krccmsitp2884 11 วันที่ผ่านมา

    JS is insane 😜

  • @alexjohnson-bassworship3150
    @alexjohnson-bassworship3150 13 วันที่ผ่านมา

    Loved it, as usual!!!

  • @MichiganTypeScript
    @MichiganTypeScript 13 วันที่ผ่านมา

    always a good day when a notification for a new Andrew Burgess comes in!

  • @Nikgek
    @Nikgek 13 วันที่ผ่านมา

    really interesting info, thanks

  • @laesseV
    @laesseV 12 วันที่ผ่านมา

    We lately had exactly that bug where a coworker removed that "unnecessary" spread of Array(x)

  • @tarikeljabiri
    @tarikeljabiri 13 วันที่ผ่านมา

    Hi man, this video made my tests green, thank you a lot 🙏

  • @TheShoAn
    @TheShoAn 12 วันที่ผ่านมา

    [1, 2, 3, 4, 5] that's how i create an array

  • @maso4u
    @maso4u 13 วันที่ผ่านมา

    do you mind going over you ide, how you have it set up and how do you navigate around it with mostly jyour keyboard

  • @deadlyecho
    @deadlyecho 11 วันที่ผ่านมา +1

    They should have just gone with a consistent approach where the sparse "empty" cells have an undefined value rather than them being literally empty which affects the stream operators of the array... typical JS 🤦‍♂️