Skip to content

Latest commit

 

History

History
42 lines (27 loc) · 859 Bytes

File metadata and controls

42 lines (27 loc) · 859 Bytes
title slug
代入 (=)
Web/JavaScript/Reference/Operators/Assignment

{{jsSidebar("Operators")}}

単純代入演算子 (=) は、変数に値を代入するために使用されます。割り当て操作は、割り当てられた値として評価されます。代入演算子を使用して、単一の値を複数の変数に割り当てることができます。

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

構文

x = y;

代入と連鎖

// 以下の変数を想定
//  x = 5
//  y = 10
//  z = 25

x = y; // x は 10
x = y = z; // x, y そして z はすべて 25

仕様書

{{Specifications}}

ブラウザーの互換性

{{Compat}}

関連情報