Created
January 24, 2014 19:31
-
-
Save slopeofhope81/8604352 to your computer and use it in GitHub Desktop.
/*4.4)Write a function called startsWith that takes two arguments, both strings. It returns true when the first argument starts with the characters in the second argument, and false otherwise. */
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
function startsWith(a, b) { | |
if (b.slice(0, a.length) == a) return true; | |
else return false; | |
} | |
a="steve" | |
b="steve is coding hard" | |
document.write(startsWith(a,b)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment