What is JS?

"JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles."

- excerpt from MDN docs. Click here to read more


Data Types

8 Data Types

  • 7 Primitive
    1. Boolean: True and False
    2. null: a special keyword denoting a null value
    3. undefined: A top-level property whose value is not defined
    4. Number: An integer or floating point number
    5. BigInt: An integer with arbitrary precision
    6. String: A sequence of characters that represent a text value
    7. Symbol: A data type whose instances are unique and immutable
  • + Object
Variables

Variables are containers that hold reusable data

3 ways to declare (create) a variable:

  • var:declares a variable ( DON'T use this method)
  • let:declares a block-scoped, local variable
  • const:declares a block-scoped, read-only named constant

Variable Assignment

The declared variable is assigned data using the assignment operator "=". The value of the assigned data can be any of the following

  • String
  • Number
  • Boolean
  • Null
  • Undefined
  • an Array
  • an Object
Comments

2 Types of Comments

comments code
                    snippet
  • Comments are treated like white space and they are discarded when the script is executed
  • They can be used to leave notes or descriptions of code and also to prevent a selection of code from running
Operators

Click the buttons to see the Operators

Check out the MDN Docs for info on Bitwise Operators

Strict Mode

What is Strict Mode?

Strict mode allows you to place a program or function in a 'strict' operating context

Declaring Strict Mode

Add the "use strict" directive at the top of a script or a function

Changes/Benefits of Strict Mode

  1. Eliminates some JavaScript silent errors by changing them to throw errors
  2. Fixes mistakes that make it difficult for JavaScript engines to perform optimizations: strict mode code can sometimes be made to run faster than identical code that's not strict mode
  3. Prohibits some syntax likely to be defined in future versions of ECMAScript

- excerpt from MDN docs. Click here to read more