Reverse a String in JavaScript - Scrimba 24 Days of #JavaScriptmas Challenge

preview_player
Показать описание
Reversing a string in JavaScript is a common interview question for beginner developers. In this video, we'll solve this Scrimba #JavaScriptmas Challenge in a few different ways and cover some useful concepts in JavaScript.

This video is part of the Scrimba 24 Days of #JavaScriptmas Challenge. Sign up now FOR FREE to get a new challenge in your inbox each day of December! 👇

_____________________________________________

Newsletter 🗞
Interested in exclusive content and discounts? 🤯 Sign up for the newsletter!
_____________________________________________

Connect with me 😀
_____________________________________________

COURSES 💻
Рекомендации по теме
Комментарии
Автор

I have fallen in love with your videos, Please make for typescript also

kondapriyanka
Автор

Make more of these.
Great explanation Mashallah

sayedrenaq
Автор

I love Scrimba platform...
Nice content, thanks for sharing it!

DevMadeEasy
Автор

Hey @James I have just start learning JavaScript could recommend approaches to take as well books or websites to read.

Thanks for the video and your time.

All the best,

Aaron

aaronlinton-chambers
Автор

Nice tutorial james. I am new to this channel and already have watched several of your tutorials.
I actually wanted to ask a question related to auth0. I have watched your tutorial but having trouble in making logged in user info available to components. Because i have to make couple of changes in components according to if user is logged in or not. Thank you James in advance.

ishaqbux
Автор

By default, I would have been partial to [...str].reverse().join('') just because it uses destructuring, which I find quite elegant. However, out of curiosity, I ran comparative tests and I found that the str.split().reverse().join() is more efficient (about 20% faster), but as the string grows in length, the difference becomes smaller until at some point the former becomes faster than the latter.

So then I went a little further and tried [...s].reduce((acc, elem)=>`${elem}${acc}`); and this turned out to be the fastest of the 3 methods. Perhaps someone can propose something even faster?

filipusfontanus