Still new to javascript and having a lot of trouble with arrays within arrays. I am tasked to pull names and quotes out of two arrays. I am tasked with making a function that can have a quote inputed into it and spit out the response "John says: Blah blah blah" They're set up as such.
let names = [ John, James, Joe, Justin]
let quotes = [
[ "Help me."
"Blah blah blah blah"
"Blah blah blah" ]
[ "Blah blah blah"
"Quote here" ]]
Now there are more names and quotes than that I just stopped for brevity's sake. The names and quotes both match up in the sense that the first name in the names array corresponds with the first array of quotes in the quotes array. Heres my attempt at writing code for it.
function whoSaidThis (quote) {
var index = quotes.indexOf(quote);
return crewmembers.index
}
this comes back as undefined and I can't figure out why.
crewmembersisn't defined anywhere, henceundefined.crewmembersis supposed to benames?) Also, are you missing some,'s in yourquoteslist ?