Skip to content

Instantly share code, notes, and snippets.

Created December 4, 2016 00:12
Show Gist options
  • Save anonymous/892607c95945f0524e0cc075d50a500e to your computer and use it in GitHub Desktop.
Save anonymous/892607c95945f0524e0cc075d50a500e to your computer and use it in GitHub Desktop.
Undefined, Null, NaN, Infinity Und, Nu, NaN, Inf studies // source https://jsbin.com/jimiku
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Und, Nu, NaN, Inf studies">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Undefined, Null, NaN, Infinity</title>
</head>
<body>
<script id="jsbin-javascript">
// -----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);
</script>
<script id="jsbin-source-javascript" type="text/javascript">// -----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. */
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);</script></body>
</html>
// -----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