Logo

Programming-Idioms

History of Idiom 49 > diff from v41 to v42

Edit summary for version 42 by programming-idioms.org:
[JS] "let" seems more modern than "var"

Version 41

2019-10-14, 12:25:00

Version 42

2019-10-30, 10:47:15

Idiom #49 Split a space-separated string

Build list chunks consisting in substrings of input string s, separated by one or more space characters.

Illustration

Idiom #49 Split a space-separated string

Build list chunks consisting in substrings of input string s, separated by one or more space characters.

Illustration
Code
var chunks = s.split(/ +/);
Code
let chunks = s.split(/ +/);