Logo

Programming-Idioms

History of Idiom 96 > diff from v22 to v23

Edit summary for version 23 by programming-idioms.org:
New JS implementation by user [programming-idioms.org]

Version 22

2016-04-06, 19:32:24

Version 23

2016-05-03, 20:51:05

Idiom #96 Check string prefix

Set boolean b to true if string s starts with prefix prefix, false otherwise.

Idiom #96 Check string prefix

Set boolean b to true if string s starts with prefix prefix, false otherwise.

Code
var b = s.startsWith(prefix);
Comments bubble
Warning! This works only in ECMAScript 6 and above.
Origin
http://stackoverflow.com/a/646643/871134