+ 2

How to reverse a string in js

Can I know How to reverse a string in js

10th Oct 2020, 7:13 AM
Çrèàtìvè Sàt
Çrèàtìvè Sàt - avatar
3 Respostas
0
You can create an array from the string, reverse the array, join all the elements by a blank space, finally convert it into a new string. source = "Hello world"; reversed = Array.from(source).reverse().join("").toString(); console.log(reversed);
10th Oct 2020, 7:52 AM
Ipang
0
Thanks for answering my question
10th Oct 2020, 8:19 AM
Çrèàtìvè Sàt
Çrèàtìvè Sàt - avatar