Mike
0
Q:

what does !! in js

var fruits = ["Banana", "Orange", "Apple", "Mango"];
var a = fruits.indexOf("Banana");
var b = !a;
var c = !!a;
console.log('a:',a);
console.log('b:',b);
console.log('c:',c);
0
const age = 20;

console.log(`I am ${age} years old.`); // not my real age
1
/* JavaScript shorthand -=
-= is shorthand to subtract something from a
variable and store the result as that same variable.
*/

// The standard syntax:
var myVar = 5; 
console.log(myVar) // 5
var myVar = myVar - 3;
console.log(myVar) // 2

// The shorthand:
var myVar = 5;
console.log(myVar) // 5
var myVar -= 3;
console.log(myVar) // 2
0

New to Communities?

Join the community