If this was about speed, it would probably be faster not to use an array at all:
const reverseString = str => { for (let r = '', i = str.lenght; i >= 0;) r += str[--i]; return r }
Uncaught ReferenceError: r is not defined...
My bad, typed that on the cellphone.
const reverseString = str => { let r = ''; for (let i = str.lenght; i >= 0;) r += str[--i]; return r }
The function doesn't return anything...it seems to be an old turntable phone..;-)
I'll try it later when I have my PC.
Found the issue, but it is indeed slower.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If this was about speed, it would probably be faster not to use an array at all:
Uncaught ReferenceError: r is not defined...
My bad, typed that on the cellphone.
The function doesn't return anything...it seems to be an old turntable phone..;-)
I'll try it later when I have my PC.
Found the issue, but it is indeed slower.