DEV Community

Cover image for Level up with JavaScript - Level 2
DevCronin
DevCronin

Posted on • Edited on

Level up with JavaScript - Level 2

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.

L2-graphic-1.png

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.

L2-graphic-2.png

Adding Two Numbers

Adding numbers is just as easy as using a (+) between numbers. The results below will show as a comment (// )assigned (number).

L2-graphic-3.png

Subtracting Numbers

The same applies with subtraction, but instead, you use (-) between numbers.

L2-graphic-4.png

Multiplying Two Numbers

When multiplying numbers we use the (*) operator.

L2-graphic-5.png

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:

  1. Parentheses
  2. Exponents
  3. Multiplication and Division (from left to right)
  4. Addition and Subtraction (from left to right)

Thank you for reading my blog! This is the second of my series on JavaScript so if you would like to read more, please follow!

See the Next Level Here

Support and Buy me a Coffee

Top comments (0)