Jacobz24 / int-u3l1-23-24-student-exercises

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lesson 3.1: Variables & Data Types

Objective

Learn about variables in JavaScript, how to declare them, assign values, and manipulate their content.

What is a Variable?

  • A variable acts like a box or container storing a piece of information known as its value.
  • Example:
    let box;

Naming a Variable:

  • Variable names should be descriptive and relevant.
  • They follow the camelCase convention (e.g., userName, totalAmount).
  • Restrictions:
    • Cannot start with a number.
    • Cannot be reserved keywords (like let).

Assigning a Value:

  • After declaring a variable, we can assign a value to it.
  • Example:
    let box;
    box = 8;

Data Types:

  • Numbers: Numerical values, can be positive, negative, or decimals.
  • Strings: Series of characters enclosed within quotation marks (either single ' ' or double " ").

Operators:

  • Used to perform arithmetic operations on variables.
  • Basic ones include: +, -, *, /.

About


Languages

Language:JavaScript 40.7%Language:HTML 33.3%Language:CSS 26.0%