I watch a video everyday after I find this channel It is like a treasure vault for programming people
@dcode-software2 жыл бұрын
That's awesome, thanks!
@عبدالقادرعبدالرحمنعبدالله2 жыл бұрын
Powerful function with powerful explanation by powerful man. Thanks for sharing.
@dcode-software2 жыл бұрын
🤣🤣 thank you!!
@عبدالقادرعبدالرحمنعبدالله2 жыл бұрын
@@dcode-software welcome, really love your contents. I am also js developer.
@qxb3482 жыл бұрын
first?
@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.
@nyxandtyr2 жыл бұрын
Good stuff, but now I need a video on regular expressions.
@2ncielkrommalzeme2102 жыл бұрын
blue background light is awsome. it suited so good
@renanbrayner9842 жыл бұрын
How many times did he said "so" in this vídeo?
@Rudxain2 жыл бұрын
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)
@bulent24352 жыл бұрын
never knew. thanks.
@joeys.42682 жыл бұрын
Every time I think I know JavaScript, I watch one of your seemingly benign videos and learn something new. Thanks!
@chanandlerbong61762 жыл бұрын
how is your cursor moving slowly from one character to another?
@dcode-software2 жыл бұрын
It's the VS Code setting which is called "cursorSmoothCaretAnimation"
@diallomamadou2582 жыл бұрын
Being using replace for long time and I never knew about that callback function. Thank you for this treasure.
@mirkosedda31962 жыл бұрын
Isnt using a map function better for these cases?
@dcode-software2 жыл бұрын
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
@Pareshbpatel6 ай бұрын
{2024-03-25}
@RodrigoSilva-un9xh2 жыл бұрын
Amazing!!!
@jameswan29632 жыл бұрын
+"3" turns string into number
@dcode-software2 жыл бұрын
Yes you could also do this 🙂
@mhdfr2 жыл бұрын
or multiply by 1, no? xD
@flamess0072 жыл бұрын
Nice one!!, thank you I just liked your video
@hugodsa892 жыл бұрын
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-software2 жыл бұрын
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.
@hugodsa892 жыл бұрын
@@dcode-software fair point.
@gillesa2902 жыл бұрын
Very useful. Thank you very much for sharing
@mdkawsarislamyeasin40402 жыл бұрын
Thanks need more video lile this 😌 Awesome video
@dcode-software2 жыл бұрын
Awesome, thank you! I plan to make more shorter videos highlighting lesser known parts of JavaScript so stay tuned 🙂
@mdkawsarislamyeasin40402 жыл бұрын
@@dcode-software plz make full playlist about DSA 😌