HiveBrain v1.2.0
Get Started
← Back to all entries
snippetjavascriptTip

JavaScript Operator Cheatsheet

Submitted by: @import:30-seconds-of-code··
0
Viewed 0 times
operatorjavascriptcheatsheet

Problem

> [!IMPORTANT]
>
> This article serves as a quick reference for JavaScript's symbolic operators, helping newcomers to the language by giving them an easily searchable name for them. If you're looking for the full operator reference for the language, you should probably check out the MDN Web Docs.
The assignment operator (=) assigns a value to a variable.
JavaScript equality comes in two flavors:

Solution

let x = 5; // Assigns the value 5 to x


> This article serves as a quick reference for JavaScript's symbolic operators, helping newcomers to the language by giving them an easily searchable name for them. If you're looking for the full operator reference for the language, you should probably check out the MDN Web Docs.
The assignment operator (=) assigns a value to a variable.
JavaScript equality comes in two flavors:
  • == (loose equality) & != (loose inequality)
  • === (strict equality) & !== (strict inequality)


@Further reading

Code Snippets

let x = 5; // Assigns the value 5 to x
// Loose equality
10 == '10'; // true
10 != '10'; // false

// Strict equality
10 === '10'; // false
10 !== '10'; // true
const a = 5;
const b = 10;
a > b;  // false
a < b;  // true
a >= b; // false
a <= b; // true

Context

From 30-seconds-of-code: operator-cheatsheet

Revisions (0)

No revisions yet.