From the course: Learn JavaScript: Write Modern Code with JavaScript ESNext
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Learn about JavaScript’s Number type - JavaScript Tutorial
From the course: Learn JavaScript: Write Modern Code with JavaScript ESNext
Learn about JavaScript’s Number type
- The first basic data type in JavaScript is numbers. Now, depending on what language you're coming to JavaScript from, you may find that JavaScript's treatment of numbers is much simpler than you're used to. In JavaScript, there are no separate types for integers and floating point numbers, although there is a separate data type for very big numbers, which we'll see in a bit. So if we have two variables, X equals 5 and pi equals 3.1415, these are both considered by JavaScript to be the same exact data type, a number. And negative numbers are allowed as well as one might expect. So using decimal notation is definitely the most common way to define numbers in JavaScript, and personally, I find that this constitutes 99% of all my use cases, but there are actually several additional ways that we can define numbers in JavaScript. For example, we can define hexadecimal numbers by putting 0x at the beginning of a number. And in more recent versions of JavaScript, that is since ES6, we're…
Contents
-
-
-
-
(Locked)
Learning objectives1m 14s
-
(Locked)
Learn the types3m 20s
-
(Locked)
Learn about JavaScript’s Number type5m 14s
-
(Locked)
Learn about JavaScript’s String type5m 14s
-
(Locked)
Learn about JavaScript’s Boolean type2m 4s
-
Learn about JavaScript’s Object type6m 9s
-
(Locked)
Learn about arrays in JavaScript3m 7s
-
(Locked)
Learn about JavaScript’s function type2m 20s
-
(Locked)
Learn about JavaScript’s undefined type2m 27s
-
(Locked)
Learn about JavaScript’s BigInt type2m 47s
-
(Locked)
Learn about JavaScript’s Symbol type3m 17s
-
(Locked)
-
-
-
-
-
-
-
-
-
-