code.ashish.me

Atom feed

Recently added: 128 Longest Consecutive Sequence, 347 Top K Frequent Elements, 045 Jump Game 2, 228 Summary Ranges, 219 Contains Duplicate 2

01 Reverse String

/**
 * Created by Ashish Patel
 * Copyright © 2017 ashish.me
 * ashishsushilpatel@gmail.com 
 */

/**
 * Problem:
 * Reverse the provided string
 * You may need to turn the string into an array before you can reverse it
 * Your result must be string
 */

 function reverseString(str){
    return str.split('').reverse().join('');
 }

 console.log(reverseString("Ashish"));

Created 2019-11-24T04:53:20+05:30 · Edit