Basic JavaScript

Junghoo Cho

cho@cs.ucla.edu

JavaScript

JavaScript History (1)

JavaScript History (2)

JavaScript History (3)

Basic Syntax (1)

Basic Syntax (2)

Basic Syntax (3)

Basic Syntax (4)

Variable Declaration

Function Declaration

function func_name(parameter1, parameter2,...)
{
    ... function body ...
    return value;
}

Types

Primitive Types

  1. number
  2. string
  3. boolean
  4. bigint
  5. symbol
  6. (null)
  7. (undefined)

number Type

boolean Type

string Type

String Template Literal

undefined and null Type

symbol Type

Type Conversion

Object Type (1)

Object Type (2)

Object Type (3)

Array (1)

Array (2)

Regular Expression

Exception Handling

try {
    throw new Error("I am thrown off!");
} catch (err) {
    console.log(err.message);
} finally {
    console.log("Finally, I am here");
}

JavaScript Object Notation (JSON)

JSON: Data Exchange

References