Clean code question

Clean code question


So i just solved the reverse a string challenge with this code
function reverseString(str) {
var array = [];
var newArray = [];
var stringBackwards = ‘’;
newArray = array.reverse();
stringBackwards = newArray.join(’’);
str = stringBackwards;

return str;


It worked and I am very happy that I figured it out. However I was just curious if down the road this would be acceptable due to its long and complicated appearance. In my googling of how to do the challenge I found this code:
var strReverse = str.split(’’).reverse().join(’’); which did the same job as my code but looks much nicer. So should I be shooting for as little code as possible or should I just worry about figuring it out and cleaning up later with the more I learn?
Thank you


Thank you very much for your input. Onward to more learning!!!