function default parameters in javascript

This commit is contained in:
gnieark 2016-05-14 22:59:22 +02:00
parent 6b10980a86
commit a1b5a6626f

View File

@ -18,7 +18,10 @@ function createElem(type,attributes){
{elem.setAttribute(i,attributes[i]);} {elem.setAttribute(i,attributes[i]);}
return elem; return elem;
} }
function connectFour(bot1,bot2,xd_check, newGame=true){ function connectFour(bot1,bot2,xd_check, newGame){
if (newGame === undefined){
newGame = true;
}
document.getElementById('fightResult').innerHTML = ''; document.getElementById('fightResult').innerHTML = '';
//create grid //create grid