Created
January 26, 2016 13:02
-
-
Save rasmuschristensen/d5e677cbf860159bd119 to your computer and use it in GitHub Desktop.
StartsWith in javascript based on pure javascript using substring or lastIndexOf
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
var data = 'Just something great'; | |
var input = 'Jus'; | |
// this one | |
data.substring(0, input.length) === input; | |
// or this one | |
data.lastIndexOf(input, 0) === 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment