Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mohamedkhallouq
GitHub Repository: mohamedkhallouq/content
Path: blob/main/files/en-us/web/javascript/reference/operators/assignment/index.md
6520 views
---
title: Assignment (=) slug: Web/JavaScript/Reference/Operators/Assignment page-type: javascript-operator browser-compat: javascript.operators.assignment
---

{{jsSidebar("Operators")}}

The assignment (=) operator is used to assign a value to a variable. The assignment operation evaluates to the assigned value. Chaining the assignment operator is possible in order to assign a single value to multiple variables.

{{EmbedInteractiveExample("pages/js/expressions-assignment.html")}}

Syntax

x = y

Examples

Simple assignment and chaining

let x = 5; let y = 10; let z = 25; x = y; // x is 10 x = y = z; // x, y and z are all 25

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also