Skip to content

Instantly share code, notes, and snippets.

@codingedgar
Last active January 4, 2021 21:55
Show Gist options
  • Save codingedgar/dab798916e17cbcd31d28c559efe1de6 to your computer and use it in GitHub Desktop.
Save codingedgar/dab798916e17cbcd31d28c559efe1de6 to your computer and use it in GitHub Desktop.
console.group('Logical AND assignment (&&=)');
let x = 0;
let y = 1;
x &&= 0;
console.log(x);
x &&= 1;
console.log(x);
y &&= 1;
console.log(y);
y &&= 0;
console.log(y);
console.groupEnd();
/*
Console:
Logical AND assignment (&&=)
0
0
1
0
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment