Dont get what i did


#1


I'm done with this. but it was the worst lesson ever. i was basically just doing copy and paste. i didnt understand most of what i did. so if someone could kindly explain it to me?

https://www.codecademy.com/courses/javascript-beginner-en-XEDZA/0/6?curriculum_id=506324b3a7dffd00020bf661#

there are no error messages. after all my inputing my syntax inputed to '[]' but before the last if statement my syntax inputed to 40. ????

var text = "My name is bibie. \
bibie has fun doing this because \
bibie wants to be a coding champ";
var myName = "bibie";
var hits = [];
for(var i = 0 ; i<text.length ; i++) {
    if(text[i] === 'b'){
        for( var j=i; j<myName.length + i;j++) {
            hits.push(text[j])
        }
    }
};
if(hits.length = 0) {
    console.log("Your name wasnt found!");
}
else{
        console.log(hits);
}

#2

The conditional expression needs to be a comparison. The above is an assignment where a condition belongs.

if (hits.length === 0)

As names go, grammar dictates that all proper names are capitalized. Does your teacher write your name, "bibie" or "Bibie".

When text is provided in a lesson, we need to respect that the author intended for us to use the exact phrase. The lesson checker already knows to look for it. Again, be mindful of the grammar...

"Your name wasnt found!"

vs.

"Your name wasn't found!"

Learning programming does not mean stepping away from the game. It is inter-disciplinary, meaning we must integrate other disciplines with this one. Grarmmar, spelling and following dirtections fits into this picture.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.