JavaScript fundamentals / 01

Types, operators, and variables

Explore primitive and object values, operator precedence, and the differences between var, let, and const.

On this page

Types of data

JavaScript values can be introduced as primitives and objects. The original lesson lists numbers, strings, booleans, undefined, null, and symbols as primitive values. Objects include arrays, functions, and regular expressions.

Console examples of typeof for numbers, arrays, strings, booleans, undefined, null, symbols, and objects

One surprising result is that typeof null returns "object". This is a longstanding quirk retained for compatibility. Arrays also produce "object", so typeof alone cannot distinguish an array from another object.

Editorial note: the original prose called the null result “string,” but its own screenshot correctly shows "object". JavaScript also has the primitive type bigint, which the original list omitted. var is function-scoped, not automatically global.

Operators

JavaScript includes arithmetic, shift, comparison, logical, conditional, and assignment operators. The original article illustrates precedence with this table:

Original Korean operator-precedence reference table, translated below

Here is the table's English reading, in its original order from higher to lower precedence:

RowOperatorsMeaning
1(), []Parentheses and brackets
2!, ~, ++, --Negation, bitwise NOT, increment, decrement
3*, /, %Multiplication, division, remainder
4+, -Addition and subtraction
5<<, >>, >>>Bitwise shifts
6<, <=, >, >=Relational comparisons
7==, !=Equality comparisons
8&Bitwise AND
9^Bitwise XOR
10|Bitwise OR
11&&Logical AND
12||Logical OR
13? :Conditional operator
14=, +=, -=, *=, /=, %=, shifts and bitwise assignmentsAssignment and compound assignment

Editorial note: this is a translation of a simplified historical chart, not a complete JavaScript precedence reference. It omits operators and distinctions; the original assignment row also contains a malformed symbol. Use parentheses to make an expression's intended grouping clear.

Declaring variables

JavaScript has three declaration keywords: var, let, and const. The original lesson recommends getting used to let and const, because var's scope can have surprising effects as programs become more complex.

The central difference between let and const is reassignment: a variable declared with let can be reassigned, while a const binding cannot.

Reassigning let prints 6; reassigning const raises an assignment-to-constant error

As the screenshot shows, let uses the latest assigned value. Attempting the same reassignment with const raises an error. This restriction concerns the binding; it does not make an object stored in a const variable deeply immutable.

Next, we will cover conditional statements. The public archive jumps from lesson 1 to lesson 3; there is no separately published lesson 2 to import.

Moved here from Tistory

I migrated this post from my Korean Tistory blog, I am Jason Lee, to this website and translated it into English. My writing and projects now live together in one place.

The original publication date, code examples, and screenshots are preserved. Editorial notes clarify known issues in the original material.

Original post on Tistory English edition · Aug 30, 2026
← Back to all articles