Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created July 9, 2016 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/bfc5bc1cee8aed82c25ca197d50a30b3 to your computer and use it in GitHub Desktop.
Save codecademydev/bfc5bc1cee8aed82c25ca197d50a30b3 to your computer and use it in GitHub Desktop.
Codecademy export
/*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