Day 96/100 Data Types
Rio Cantre
Posted on December 20, 2021
Seven fundamental data types:
-
Number: Any number, including numbers with decimals:
4
,8
,1516
,23.42
. -
String: Any grouping of characters on your keyboard (letters, numbers, spaces, symbols, etc.) surrounded by single quotes:
' ... '
or double quotes" ... "
. Though we prefer single quotes. Some people like to think of string as a fancy word for text. -
Boolean: This data type only has two possible values— either
true
orfalse
(without quotes). It’s helpful to think of booleans as on and off switches or as the answers to a “yes” or “no” question. -
Null: This data type represents the intentional absence of a value, and is represented by the keyword
null
(without quotes). -
Undefined: This data type is denoted by the keyword
undefined
(without quotes). It also represents the absence of a value though it has a different use thannull
. - Symbol: A newer feature to the language, symbols are unique identifiers, useful in more complex coding. No need to worry about these for now.
- Object: Collections of related data.
Code Snippets
var prices = [1.23, 48.11, 90.11, 8.50, 9.99, 1.00, 1.10, 67.00];
prices[0] = 2.33;
prices[2] = 99.00;
prices[6] = 3.00;
for (var index = 0; index<prices.length; index++){
if(index===0){
prices[index]=11;
}
else if(index===2){
prices[index]=33;
}
else if(index===6){
prices[index]=77;
}
}
console.log(prices);
Summary
Yesterday was the 2nd "Surprise" Drill in Technical line. Luckily, the electricity came back later the day and same time got extensions to pay the bills. I'm so coward that I could not afford to pay the bills on time, now I must submit my small useful blog on the same posting time.
💖 💪 🙅 🚩
Rio Cantre
Posted on December 20, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.