Created
February 1, 2019 17:57
New ES6 string functions result in cleaner code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// New ES6 string functions result in cleaner code | |
// ES 6 | |
"hello".startsWith("ello", 1) // true | |
"hello".includes("ell") // true | |
// ES 5 | |
"hello".indexOf("ello") === 1; // true | |
"hello".indexOf("ell") !== -1; // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment