DEV Community

Discussion on: Interview Qs Decoded - # 2

Collapse
 
arthurabia profile image
Arty ‽ • Edited

Nice use of pop()!
I would not have think of that...
Here's how I went about it :

let str = 'please reverse me';
let newStr = '' ;
for(let i= str.length -1;i >=0;i--){
newStr += str[i]
}
console.log(newStr)