Day 71: Learning Javascript Basics

Hi! Glad to be back. I would be sharing 10 lessons I learnt from my course on JavaScript via free code camp today. Leggo

[if !supportLists]1. [endif]When JavaScript variables are declared, they have an initial value of undefined. If a mathematical operation or concatenation of a string is done on an undefined variable your result will be NaN which means "Not a Number" or undefined for strings.

[if !supportLists]2. [endif]Unlike var, when you use let, a variable with the same name can only be declared once.

[if !supportLists]3. [endif]In ES6, you can also declare variables using the const keyword. They are a constant value, which means that once a variable is assigned with const, it cannot be reassigned.

[if !supportLists]4. [endif]Number is a data type in JavaScript which represents numeric data. JavaScript uses the - symbol for subtraction and + for addition.

[if !supportLists]5. [endif]JavaScript uses the * symbol for multiplication of two numbers and / symbol for division.

[if !supportLists]6. [endif]increment or addition of one to a variable can easily be done with the ++ operator. Decrement or decrease of a variable by one can easily be done with the -- operator.

[if !supportLists]7. [endif]Decimal numbers in variables can also be stored too. Decimal numbers are sometimes referred to as floating point numbers or floats.

[if !supportLists]8. [endif]In JavaScript, you can also perform calculations with decimal numbers, just like whole numbers.

[if !supportLists]9. [endif]The remainder operator % gives the remainder of the division of two numbers.

[if !supportLists]10. [endif]In programming, it is common to use assignments to modify the contents of a variable. Remember that everything to the right of the equals sign is evaluated first. One such operator is the += operator.