我现在正在编写一些脚本,当我试图在函数内部否定布尔值时遇到了问题。我的意思是这个:
var test = true;
function changeThisBoolPlease(asd){
asd=!asd;
}
alert(test);
changeThisBoolPlease(test);
alert(test);
如果alerts为true,则为true。
有什么想法吗?JS参考文献不完美吗?
编辑:
好的,这只是我的函数的一部分:
function przesun(kolor, figury, castlings, x1, y1, x2, y2, strona) {
kolor = nowaPozycjaKolor(kolor,x1, y1, x2, y2);
figury = nowaPozycjaFigur(figury,x1, y1, x2, y2);
strona = !strona;
}
实际上我无法返回这个值。怎么办?
strona
吗?如果是,请直接返回它并分配返回值。 - robbmj