JavaScript answer for String Reverse code kata