Data Types

We start out today with JavaScript basics, Data Types. Data Types are also known as "primitives". They are immutable, which means that they themselved cannot be changed, only reaassigned.

The basic Data Types are:

  1. Undefined
  2. null
  3. Boolean - true and false
  4. Number - 90210, 3.1, -55 (in javaScript this is the main type for all number except BigInt). There is no float, int, etc...
  5. String - "Why, hello there!"
  6. Symbol - this is new in ES 2015 and we will leave it out of consideration for now
  7. BigInt - this is new in the latest version of ES. It is for representing numbers larger than 253 - 1, something that the classic Number type cannot do. BigInts are marked with an n at the end (e.g., 9007199254740992n or 5n). An important thing to know about BigInts is that they cannot be implicitly coerced into numbers. For example, 10n - 2 results in an error
  8. Object - All other data types in JavaScript are Objects, this includes arrays, functions, etc...


The type of operator, for the most part return the type of a value. For exapmple:

var x = 1;
console.log(typeof x);
$: number
typeof 'test'; //'string'
typeof 99; //'number'
typeof function(){}; //'function'
typeof {}; //'object'
typeof [1,2,3]; //'object'

Controll Structures

A control structure are parts of the code that direct what happens next in a programm.

from TutorialPoint
Sr.No. StatementDescription
1.switch caseA block of statements in which execution of code depends upon different cases. The interpreter checks each case against the value of the expression until a match is found. If nothing matches, a default condition will be used.


I got to carried away in the project today. I ended up finishing it and it wasn't due until MondayπŸ‘¨β€πŸ’»πŸ€£πŸ˜΄ And now I'm to exhausted to finish this. I will however update it tomorrow with all my extra time. So please, check back. I am only publishing this now, unfinished, in order to keep up with my goal of writing everyday.