js.l10
// (&&) => AND gate.
// (||) => OR gate.
// (!) => not gate.
EXAMPLE:
-------------
(&&) DEFINES => 'TRUE' AND 'TRUE' = 'TRUE' OTHERWISE 'FALSE'.
(||) DEFINES => 'FALSE' AND 'FALSE' = 'FALSE' OTHERWISE 'TRUE'.
(!) DEFINES => 'TRUE' = 'FALSE'___'FALSE' = 'TRUE'.
EXAMPLE:
-------------
const Dolphins = ((96+108+89) / 3);
const Koalas = ((88+91+110) / 3);
console.log(`Dolphins point: ${Dolphins}\nKoalas point: ${Koalas}`);
if (Dolphins > Koalas) {
console.log(`Winner is 'Dolphins'. Congratulation's Dolphins team!`);
} else if (Dolphins < Koalas){
console.log(`Winner is 'Koalas'. Congratulation's Koalas team!`);
} else {
console.log(`DRAW. SUER MOMENT.`);
}
--------------------------------------------------
// typeof() // returens type of a variable.
// instanceof() // returens true if an object is an instance of an object type.
EXAMPLE:
1.console.log(typeof 42);
// expected output: "number"
2.function Car(make, model, year) {
this.make = make;
this.model = model;
this.year = year;
}
const auto = new Car('Honda', 'Accord', 1998);
console.log(auto instanceof Car);
// expected output: true
Are there any code examples left?
New code examples in category Other