Logo

Programming-Idioms

History of Idiom 97 > diff from v30 to v31

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

Version 30

2017-11-30, 21:18:17

Version 31

2018-05-01, 12:31:08

Idiom #97 Check string suffix

Set boolean b to true if string s ends with string suffix, false otherwise.

Illustration

Idiom #97 Check string suffix

Set boolean b to true if string s ends with string suffix, false otherwise.

Illustration
Extra Keywords
tail
Extra Keywords
tail
Code
var b = s.endsWith(suffix);
Comments bubble
Warning! This works only in ECMAScript 6 and above.
Doc URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith