Global Trend Radar
Web: developer.mozilla.org US web_search 2026-05-01 05:38

JavaScriptデモ:剰余代入(%=)演算子 - MDN

原題: JavaScript Demo: Remainder assignment (%=) operator - MDN

元記事を開く →

分析結果

カテゴリ
AI
重要度
54
トレンドスコア
18
要約
剰余代入(%=)演算子は、JavaScriptにおいて数値の剰余を計算し、その結果を変数に代入するための演算子です。この機能は広く利用可能で、多くのデバイスやブラウザのバージョンで正常に動作します。
キーワード
Remainder assignment (%=) - JavaScript | MDN Skip to main content Skip to search Remainder assignment (%=) Baseline Widely available This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015. Learn more See full compatibility Report feedback The remainder assignment ( %= ) operator performs remainder on the two operands and assigns the result to the left operand. Try it let a = 3; console.log((a %= 2)); // Expected output: 1 console.log((a %= 0)); // Expected output: NaN console.log((a %= "hello")); // Expected output: NaN Syntax js x %= y Description x %= y is equivalent to x = x % y , except that the expression x is only evaluated once. Examples Using remainder assignment js let bar = 5; bar %= 2; // 1 bar %= "foo"; // NaN bar %= 0; // NaN let foo = 3n; foo %= 2n; // 1n Specifications Specification ECMAScript® 2027 Language Specification # sec-assignment-operators Browser compatibility See also Assignment operators in the JS guide Remainder ( % ) Help improve MDN Learn how to contribute This page was last modified on Jul 8, 2025 by MDN contributors . View this page on GitHub • Report a problem with this content

類似記事(ベクトル近傍)