7/7 this works, but


#1

This works, but it does not store each character of the name to the hits array, it stores the whole string.

is there a way to store characters using the match method?

I also cant figure out how to use the match method with the myName variable.

/*jshint multistr:true */

var text = " hello Lauren hellohello Lau hello \ hello hellohello hello hello v v v v hellohello v v hello hello v Lau hello v v v hellov v \ hello v v v hello v hello v hello v v v v v hello v hello hello v LauLau Lau hello v hello v v \ hello v Lau hello v Looser hello Lauren v v";

var myName = "Lauren"; //redundant!

var hits = text.match(/Lauren/g);

if (hits === null) {

console.log("Your name wasn't found!")
}else {
    console.log(hits)
                    }

#2

The instruction asks you to store the hits into an array, so you shouldn't use a match method.


#3

This is what I would do to solve this.

/*jshint multistr:true */
var text = "hello, nice to meet you! my name is Amber";
my name is Amber";
var myName = "Amber";

if(!text.includes(myName)){
console.log("your name wasn't found!");
}else{
console.log(myName.split(''));
}