As your first JavaScript MP, this MP serves as an introduction to programming in JavaScript. To complete this MP, you will need to complete a function that tests if two selected cells contain the same or different values.

This MP, like all MPs in CS 105, is a solo assignment. Review the course syllabus to understand exactly what is expected of you when it comes to academic integrity.


To get started, you will first need to download the base files for MP1 here. The file you downloaded is a ZIP file and must be extracted before it can be used.

Once extracted, you should have a directory that has exactly three files: matchGame.html, mp1.js, and cs105.css. By default matchGame.html will open up in a web browser, which should display the MP1 web page. If you attempt to play the game, you will notice that it an alert box pops up with an error as soon as you make (or fail to make) a match.


For this MP, you must write a new function inside of mp1.js called testForMatch. This function does not take any arguments, but this function must:

In order to find out if the cell is a match, you must call a function to find out what cell was clicked:


When you are ready to test this MP, make sure to save the mp1.js file and then open or refresh the matchGame.html page in a web browser. Start playing the game!

Submission and Grading

Due to the very simple nature of this MP, there will be no partial credit. You should make sure your MP works completely before submitting it.

Submit MP1 here