js.l9 code example
Example: js.l9
// (==) => equal to.
// (===) => equal to value & data-type.
// (!=) => not equal to.
// (!==) => not equal to value & data-type.
// (>) => grater then.
// (<) => smaller then.
// (>=) => grater then or equal to.
// (<=) => smaller then or equal to.
// (?) => ternary operator.
EXAMPLE:
Ternary operator,
var age = 18;
age >= 18 ? console.log('true') : console.log('false');
--------------------------------------------------
// 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