How to negate bool inside function in JS?

Viewed 18972

I'm writing some script now and I have a problem when trying to negate boolean inside a function. I mean this:

var test = true;

function changeThisBoolPlease(asd){
  asd=!asd;
}

alert(test);
  changeThisBoolPlease(test);
alert(test);

alerts true, then true.

Any ideas? Isn't JS reference perfect?

EDIT:

Ok, this was only a part of my function:

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;
}

Actually I cannot return this value. How to?

3 Answers
Related