Logo

Programming-Idioms

History of Idiom 41 > diff from v34 to v35

Edit summary for version 35 by programming-idioms.org:
[JS] Inverted t, s

Version 34

2018-01-03, 23:23:20

Version 35

2018-01-03, 23:24:55

Idiom #41 Reverse a string

Create string t containing the same characters as string s, in reverse order.
Original string s must remain unaltered. Each character must be handled correctly regardless its number of bytes in memory.

Illustration

Idiom #41 Reverse a string

Create string t containing the same characters as string s, in reverse order.
Original string s must remain unaltered. Each character must be handled correctly regardless its number of bytes in memory.

Illustration
Code
s = t.split("").reverse().join("");
Code
var t = s.split("").reverse().join("");