Wherefore art thou quotation marks in array

Wherefore art thou quotation marks in array
0

#1

Tell us what’s happening:
I was at this point and was getting the right results back (I think) but missing the quotes in the array. I can’t figure it out.

Your code so far


function whatIsInAName(collection, source) {
	var arr = [];
  let newCol =  collection.find(function(value) {
   	return value.last === source.last;
    })
	arr.push(newCol);
  
  // Only change code above this line
  return arr;
}

whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou/


#2

I think find only returns the first instance. It does not find all instances.


#3

#4

Instead of find use filter.
No need to use push.


#5

Those quotation marks are syntactically necessary for strings. They are not characters in the strings themselves.