Introduction

Console

  • console is an object, i.e., a collection of data and actions.

  • console.log() is similar to Python's print().

// single line comment
console.log("Hello")

/*
multi
line
comment
*/

Data Types

Type
Description
Example

Number

Integers and floats.

4, 23.4

Bigint

Greater than 2^53-1 or less than -(2^53-1)

1234567890123456n

String

Anything enclosed in single or double quotes

"Hello!"

Boolean

Has only two values

True,False

Null

Intentional absence of a value

null

Undefined

A given value does not exist

undefined

Symbol

Unique IDs

Objects

Collections of related data

All but objects are considered primitive data types.

Properties

Methods

Methods are actions we can perform.

Built-in Objects

Variables

Declaration

const and let is the preferred way to declare variables. var is deprecated.

let signals that the variable can be reassigned a different value. We can also use var and let to declare an empty variable.

const indicates a constant and cannot be changed (TypeError) or declared empty (SyntaxError).

circle-exclamation

Operators

The increment (++) and the decrement (--) operators will increase and decrease the variable's value by 1, respectively.

String Interpolation

We can interpolate variables into string using template literals.using backticks (`).

typeof

Last updated