Pass window variable as parameter in Javascript

  javascript, pass-by-reference

Passing a window global variable through JS does not seem to be working. The following code is printing true:

window.nada = true;
tata(window.nada);
console.log(window.nada);

function tata(lala)
{
  lala = false;
}

How can I affect the window.nada global variable inside the tata function?

Source: Ask Javascript Questions

LEAVE A COMMENT