Level up with JavaScript - Level 2
In this blog series tutorial, you will be introduced to some of the basic JavaScript programming concepts.
This is geared toward beginners and anyone looking to refresh their knowledge.
See the Previous Level Here
Level 2 will cover Uninitialized Variables, Case Sensitive Variables, Adding Numbers, Subtracting Numbers, Multiplying Numbers, and Order of Operations.
Uninitialized Variables
When a variable is not set to a value, it is defaulted as "undefined". Uninitialized means a variable was declared (i.e. with var, let, or const) and was NOT assigned (=) to a value.
Case Sensitive Variables
In JavaScript case-sensitivity matters. "LEVEL" is not the same as "level". The best practice is to use all lower case in single word variables.
In multi-word variables use lower case for the first word, and capitalize the first letter of any subsequent words. This is called camelCase.
Adding Two Numbers
Adding numbers is just as easy as using a (+) between numbers. The results below will show as a comment (// )assigned (number).
Subtracting Numbers
The same applies with subtraction, but instead, you use (-) between numbers.
Multiplying Two Numbers
When multiplying numbers we use the (*) operator.
Order of Operations
JavaScript follows the order of operations. This is the order in which a math problem is solved.
In order of first to last:
- Parentheses
- Exponents
- Multiplication and Division (from left to right)
- Addition and Subtraction (from left to right)
Top comments (0)