DEV Community

Cover image for Day 96/100 Data Types
Rio Cantre
Rio Cantre

Posted on • Originally published at dev.to

Day 96/100 Data Types

banner

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 or false (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 than null.
  • 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);

Enter fullscreen mode Exit fullscreen mode

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.

resource

Top comments (0)