Bug: Inavlid solution for search accepted as correct


If you use the wrong operator for comparison ("=" instead of "==") * in the condition, then every lastName of every person in the array gets changed to your search argument and therefore every person is "correctly" printed out.

Something like this inside the loop for the function search(lastName):
if (contacts[i].lastName = lastName) {

  • I made that mistake because I came back to the JavaScript course after a long time programming in VB.net, which uses single "=" as both assignment and comparison operator...