One of the most POWERFUL features of JavaScript...

Поділитися
Вставка
  • Опубліковано 3 лис 2024

КОМЕНТАРІ • 45

  • @joeys.4268
    @joeys.4268 2 роки тому

    Every time I think I know JavaScript, I watch one of your seemingly benign videos and learn something new. Thanks!

  • @jameswan2963
    @jameswan2963 2 роки тому +6

    I watch a video everyday after I find this channel
    It is like a treasure vault for programming people

  • @2ncielkrommalzeme210
    @2ncielkrommalzeme210 2 роки тому

    blue background light is awsome. it suited so good

  • @عبدالقادرعبدالرحمنعبدالله

    Powerful function with powerful explanation by powerful man.
    Thanks for sharing.

  • @diallomamadou258
    @diallomamadou258 2 роки тому

    Being using replace for long time and I never knew about that callback function. Thank you for this treasure.

  • @Rudxain
    @Rudxain 2 роки тому

    I usually do `str.replace(/./gs, c => dict[c] || c)`. It's a common idiom to replace chars based on a dictionary mapping. The regex I used guarantees that there's no conditional branching (because of "dot-all" flag), substantially increasing iteration performance.
    But be careful when iterating strings (in any way, not just the idiom I showed), because some JS functions iterate over code-units (split), code-points (spread syntax, and `for of` loops), or grapheme clusters (Intl.segmenter)

  • @維倫劉
    @維倫劉 2 роки тому

    Thanks for sharing!

  • @nyxandtyr
    @nyxandtyr 2 роки тому

    Good stuff, but now I need a video on regular expressions.

  • @adnantariq3346
    @adnantariq3346 Рік тому

    So it’s a cool example, thank you. But given the trend, that is typescript is now mostly used instead of JavaScript, how hard or how much more overhead would there be to write this in typescript? Just wondering.

  • @pratikwadekar4981
    @pratikwadekar4981 2 роки тому

    This video is a treasure trove!! Thanks man

  • @gillesa290
    @gillesa290 2 роки тому

    Very useful. Thank you very much for sharing

  • @RodrigoSilva-un9xh
    @RodrigoSilva-un9xh 2 роки тому

    Amazing!!!

  • @mdkawsarislamyeasin4040
    @mdkawsarislamyeasin4040 2 роки тому

    Thanks need more video lile this 😌
    Awesome video

    • @dcode-software
      @dcode-software  2 роки тому +1

      Awesome, thank you! I plan to make more shorter videos highlighting lesser known parts of JavaScript so stay tuned 🙂

    • @mdkawsarislamyeasin4040
      @mdkawsarislamyeasin4040 2 роки тому

      @@dcode-software plz make full playlist about DSA 😌

  • @bulent2435
    @bulent2435 2 роки тому

    never knew. thanks.

  • @adehenry9591
    @adehenry9591 2 роки тому

    Very cool replacer function 😎

  • @flamess007
    @flamess007 2 роки тому

    Nice one!!, thank you I just liked your video

  • @SonAyoD
    @SonAyoD 2 роки тому

    Great video! More please bro!

  • @zhunter8596
    @zhunter8596 2 роки тому

    Thnxs for new information

  • @jul1o651
    @jul1o651 2 роки тому

    Cool video, thanks

  • @anush8
    @anush8 2 роки тому

    Amazing.

  • @chanandlerbong6176
    @chanandlerbong6176 2 роки тому

    how is your cursor moving slowly from one character to another?

    • @dcode-software
      @dcode-software  2 роки тому +1

      It's the VS Code setting which is called "cursorSmoothCaretAnimation"

  • @mirkosedda3196
    @mirkosedda3196 2 роки тому

    Isnt using a map function better for these cases?

    • @dcode-software
      @dcode-software  2 роки тому

      Possibly, there are always other ways to do things. As I mentioned in another comment, this video is to demonstrate the usage of the replacer function but doesn't guarantee its the best way to do something

  • @jameswan2963
    @jameswan2963 2 роки тому +1

    +"3" turns string into number

    • @dcode-software
      @dcode-software  2 роки тому +1

      Yes you could also do this 🙂

    • @mhdfr
      @mhdfr 2 роки тому

      or multiply by 1, no? xD

  • @renanbrayner984
    @renanbrayner984 2 роки тому

    How many times did he said "so" in this vídeo?

  • @qxb348
    @qxb348 2 роки тому +1

    first?

  • @hugodsa89
    @hugodsa89 2 роки тому

    dude this could really be done in such a better way. instead of selecting all digits to begin with why not allow the regex to select only even numbers?

    • @dcode-software
      @dcode-software  2 роки тому +1

      If it was up to me, yes I would do it that way but the point of this video is to show an example of how this function is used, not so much the intention of trying to only replace even numbers.

    • @hugodsa89
      @hugodsa89 2 роки тому

      @@dcode-software fair point.

  • @Pareshbpatel
    @Pareshbpatel 7 місяців тому

    {2024-03-25}