Javascript: Javascript Programming For Beginners Guide To Javascript Coding, Javascript Programs And Javascript Language by Josh Thompsons

Javascript: Javascript Programming For Beginners Guide To Javascript Coding, Javascript Programs And Javascript Language by Josh Thompsons

Author:Josh Thompsons
Language: eng
Format: azw3, epub, pdf
Published: 2017-06-12T07:00:00+00:00


We have already covered comparison operators and of conditional statements in earlier sections but, just as a refresher, here are a few examples:

OperatorDescriptionExample

==equal toif (day == "Tuesday")

>greater thanif (earnings > 9000)

<less thanif (age < 18)

Boolean values of expressions are fundamental to conditions and comparisons in JavaScript.

Everything That has a "Real" Value is True

Examples

95

3.14

-17

"Good Day"

"false"

6 + 3 + 3.14

4 < 7

Everything That Doesn’t Have a "Real" is False

0 evaluates false in Boolean:

var x = 0;

Boolean(x); // returns false

As does the value of -0:

var x = -0;

Boolean(x); // returns false

And the value of “”, which is an empty string:

var x = "";

Boolean(x); // returns false

Also false is the value of undefined:

var x;

Boolean(x); // returns false

And the value of null:

var x = null;

Boolean(x); // returns false

As is the value of false:

var x = false;

Boolean(x); // returns false

And the value of NaN:

var x = 10 / "H";

Boolean(x); // returns false



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.