Table of contents
No headings in the article.
PRIMITIVE DATA TYPE: In the primitive data type,the data is stored directly in the location variables accesses. It is stored on the stack. When you want to access primitive data type you access it by it's Value.
THERE ARE DIFFERENT EXAMPLES OF PRIMITIVE DATA TYPES:
1; NUMBERS 2; STRING 3; BOOLEAN 4; NULL 5; UNDEFINED 6; SYMBOLS (ES6)
Today I'll be exploring all you need to know about THE NUMBERS.
NUMBERS: JavaScript has one number type, some other languages actually have more than one number type. JavaScript have a number type to represent whole numbers which are usually called INTEGERS and then a separate type to represent decimal numbers called FLOATING POINTS OR FLOAT'S. And the reason for this is that it takes a lot more memory to store a decimal. The number types include both POSITIVE NUMBERS, NEGATIVE NUMBERS, DECIMAL NUMBERS. We also have basic maths operation that are built in JavaScript. There are also some symbols that you are probably familiar with they are pretty standard across programming languages which are P E M D A S
P= Parentheses
E= Exponent
M= Multiplication
D= Division
A= Addition
S= Subtraction
Parentheses runs first the Exponent, then Multiplication, then Division, then Addition, then Subtraction.
The two operators you may not be familiar with are:
MODULO (Remainder Operator %) : This is represented by the character we use for the percent sign. Let's take a look at one example (27 % 2 // 1) what this implies is that (27 % 2) i.e 27 mod 2, two goes into twenty seven how many times? It goes in thirteen times then It has one remainder that's the 1 I added up there. Another thing to note about Modulo or Mod is that it tells us if a number is odd or even.
The next operator is :
EXPONENTIATION : It is represented by two stars ( ) it will take our first number and raise it to the power of our second number. 24=16 that is 2 raise to power 4 = 16.
You don't need to be a maths expert to be able to do this.
I'll post about the remaining primitive data types soon.