How can I make my sentence spell backwards in JavaScript? | Sololearn: Learn to code for FREE!

+1

How can I make my sentence spell backwards in JavaScript?

Hi. I am planning to make a code that people can reverse their own sentences (Not just the words, the spelling). However, I don't know how to code about that. The code requires an input for them to put their own sentence. Can somebody please tell me the code? Thank you! 😊

11/16/2017 2:01:10 PM

W1LL1AM823

7 Answers

New Answer

+2

Do you want sth like this: str = "Hello World"; str = str.split("").reverse().join(""); // str is now "dlroW olleH"

+2

@Skayo Thanks for the code! 😊

+1

If my code helped you then please set it as accepted answer. Thank you!

0

Hi Skayo! I tried copying your code but when I run the code the output reads "No output." Is there a better code for this? I would require an input. Thx! 😊

0

Oh my bad! Please replace line 2 with: str = str.split("").reverse().join("");

0

Hi Skayo! The code you gave me is the same as what you said. Try with the correct one please. Thanks!

0

No I changed the other answer too you know