-
-
Save codecademydev/bfc5bc1cee8aed82c25ca197d50a30b3 to your computer and use it in GitHub Desktop.
Codecademy export
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
/*jshint multistr:true */ | |
var text = "this is really a really long string \ | |
of text but it doesnt matter because Aakriti its really \ | |
just text. i mean, i don't really know Aakriti what this is \ | |
but it doesnt need to mean anything"; | |
var myName = "Aakriti"; | |
var hits = []; | |
for (var i = 0; i < text.length; i++) { | |
if (text[i] === 'A') { | |
for (var j = 1; j < (i + myName.length); j++) { | |
hits.push( text[j] ) | |
} } } | |
if(hits.length == 0) { | |
console.log("Your name wasn't found!") | |
} else { | |
console.log (hits) } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment