Game of Concentration


Created by Maggie Yan 


Languages used 
HTML, CSS, Javascript

Objective 
This project was for an assignment in my Intro to Front-End Web Development course. The objective of the project was create a web application game where the player tries to achieve all eight matches with the lowest number of tries by rembering the locations of the matching images. The purpose of this project was to use Javascript and jQuery to make the webpage interactive and dynamically updating for the game, by writing functions, using event handlers and setTimeout().                                       



The Process
First, functions were written so that once a cell has been clicked on, the hidden image will appear in the cell, and one second later, the image will disappear. This was done using with the help of setTimeout(). Event handlers were added so that the correct functions would be invoked when the game images were clicked on. The first click was distinguished from the second click by using global variables to store the number of times the user has clicked the images. If two images match, their URLs should be the same. Additional global variables were created to keep track of the status of the game. 



A snippet of Javascript code that does the operations described above . See full code on Github.