-
-
Save defields923/f2415364f890438ced7d03bdb1774803 to your computer and use it in GitHub Desktop.
Undefined, Null, NaN, InfinityUnd, Nu, NaN, Inf studies// source https://jsbin.com/jimiku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -----Undefined, Null, NaN, Infinity, -Infinity----- // | |
/* Undefined and null are both special values that signify the absence of meaningful | |
data. Undefined is considered its own data type, but null is considered an object by Javascript, | |
which can be misleading. Null, more specifically, should represent the nonexistence of | |
something. */ | |
"use strict"; | |
console.log(typeof undefined); | |
/* NaN stands for "not a number," and represents instances of calculations that do | |
not result in a precise or meaningful answer: */ | |
console.log(1 * "what are you doing?"); // this is nonsensical | |
/* Using the typeof method on NaN will return "number", though it is not. */ | |
/* Two other values that are grouped into the "number" type are the keywords Infinity and | |
(-Infinity)--the former representing infinity into the positive integers and the latter | |
into the negative integers. It is best not to trust infinity-based calculations, as they | |
will often lead to NaN. */ | |
console.log(typeof -Infinity); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment