Algorithms: String Reversal

Jay Wen
1 min readJul 30, 2020

String reversals are one of the most common questions on tech interviews. There are many different ways to do this and one way I’d like to do this is by using the built in JavaScript methods.

function reverse(string) {return str.split('').reverse().join('')}reverse('hello there')

Breaking down each method:

We call .split('') on the the string which separates each character into its own element. It returns ["h", "e", "l", "l", "o", " ", "t", "h", "e"…

--

--

Jay Wen

Hey! I’m a full stack software engineer. Here’s where I document my technical learning and any tips/skills I can share as I continue to learn. :)