MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / check

Function check

assets/js/makeMatchGame.js:379–404  ·  view source on GitHub ↗
(counter)

Source from the content-addressed store, hash-verified

377 check(counter);}, 300);
378};
379function check(counter){
380 document.getElementById("mov").innerHTML = " "+(++moves);
381
382 if(match==2 && counter[0].className!==counter[1].className){
383 counter.forEach(box => {
384 box.childNodes[0].style.visibility="hidden";
385 box.removeAttribute('a');
386
387 })}
388 if(match==4 && (counter[0].className!==counter[1].className || counter[1].className!==counter[2].className || counter[2].className!==counter[3].className)){
389 counter.forEach(box => {
390 box.childNodes[0].style.visibility="hidden";
391 box.removeAttribute('a');
392 });
393 }
394 cardDiv.forEach(card => {
395 if(card.hasAttribute('a'))
396 ++win;
397 });
398 if(win==cardDiv.length){
399 var d2=parseInt(Date.now());
400 var time = getTime(d2-d1);
401 alert("Time Taken: "+time+"\nYou win : Press Play Again! ");}
402 win=0;
403 counter.length=0;
404};
405function getTime(duration){
406 seconds = Math.floor((duration / 1000) % 60),
407 minutes = Math.floor((duration / (1000 * 60)) % 60),

Callers 1

showDesignFunction · 0.70

Calls 1

getTimeFunction · 0.85

Tested by

no test coverage detected