One of the most POWERFUL features of JavaScript...

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ม.ค. 2025

ความคิดเห็น • 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

  • @diallomamadou258
    @diallomamadou258 2 ปีที่แล้ว

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

  • @2ncielkrommalzeme210
    @2ncielkrommalzeme210 2 ปีที่แล้ว

    blue background light is awsome. it suited so good

  • @عبدالقادرعبدالرحمنعبدالله
    @عبدالقادرعبدالرحمنعبدالله 2 ปีที่แล้ว +7

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

  • @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)

  • @pratikwadekar4981
    @pratikwadekar4981 2 ปีที่แล้ว

    This video is a treasure trove!! Thanks man

  • @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 😌

  • @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.

  • @維倫劉
    @維倫劉 2 ปีที่แล้ว

    Thanks for sharing!

  • @gillesa290
    @gillesa290 2 ปีที่แล้ว

    Very useful. Thank you very much for sharing

  • @SonAyoD
    @SonAyoD 2 ปีที่แล้ว

    Great video! More please bro!

  • @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

  • @flamess007
    @flamess007 2 ปีที่แล้ว

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

  • @adehenry9591
    @adehenry9591 2 ปีที่แล้ว

    Very cool replacer function 😎

  • @RodrigoSilva-un9xh
    @RodrigoSilva-un9xh 2 ปีที่แล้ว

    Amazing!!!

  • @nyxandtyr
    @nyxandtyr 2 ปีที่แล้ว

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

  • @zhunter8596
    @zhunter8596 2 ปีที่แล้ว

    Thnxs for new information

  • @jul1o651
    @jul1o651 2 ปีที่แล้ว

    Cool video, thanks

  • @bulent2435
    @bulent2435 2 ปีที่แล้ว

    never knew. thanks.

  • @anush8
    @anush8 2 ปีที่แล้ว

    Amazing.

  • @renanbrayner984
    @renanbrayner984 2 ปีที่แล้ว

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

  • @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

  • @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.

  • @qxb348
    @qxb348 2 ปีที่แล้ว +1

    first?

  • @Pareshbpatel
    @Pareshbpatel 10 หลายเดือนก่อน

    {2024-03-25}