CybArt's public fiddles
-
Multiplication operator applied to non-numeric data, Example 1
A non-numeric value gets converted to a number behind the scenes, using Number function
-
An advanced way to assign a value to a variable
The preferredObject contains the value that is preferred if it is available, where;s the backupObject contains the default. If the first value is null, then the second value is assigned! This pattern is used very frequently for variable assignment!
-
Logical OR operator is also short-circuited
No-Library (pure JS), HTML, CSS, JavaScript
-
App,lying logical OR operator to two undefined values
In this case, obviously, undefined is returned
-
Applying logical OR to two NaNs
If both operands are NaN, then NaN is returned
-
Applying logical OR to two nulls
If both operands are equal to null, then null is returned
-
Logical OR operand applied to two objects
IN this case, the first operand is returned
-
Logical OR operator applied to false and something else
If the first operand evaluates to false, then the second operand is returned
-
Logical OR operator applied to object and something else
If the first operand is an object, the first operand is returned
-
Illustrations of logical OR operator
true is stronger than false
-
Logical OR operator illustration
No-Library (pure JS), HTML, CSS, JavaScript
-
Logical AND is a short-circuited operator, Example 2 out of 2
If the first operator evaluates to false, the expression stops evaluating: 'nough said!
-
Logical AND is a short-circuited operator: Example 1 of 2.
If first value is true, the expression continues to evaluate
-
Applying logical AND operator to undefined and some other data type
If either operand is undefined, then undefined is returned
-
Applying logical AND operator to NaN and some other value
If either operand is a NaN, then NaN is returned
-
Applying logical AND operator to something and null
if either operand is null, then null is returned
-
Applying logical AND operator to two objects or to some other data type and an object
If the second operand is an object, then the object is returned only if the first operand evaluates to true
-
Logical AND operator applied to an object and anothe operand
If the first operand is an object, then a second operand is always returned
-
Logical AND applied to Boolean values
No-Library (pure JS), HTML, CSS, JavaScript
-
Logical AND operator
false is stronger than true