| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Operators/Multiplication | [Back] [Original] |
Get to know MDN better
console.log(3 * 4);
// : 12
console.log(-3 * 4);
// : -12
console.log("3" * 2);
// : 6
console.log("foo" * 2);
// : NaN
x * y
* 2 TypeError
2 * 2; // 4
-2 * 2; // -4
Infinity * 0; // NaN
Infinity * Infinity; // Infinity
"foo" * 2; // NaN
"2" * 2; // 4
2n * 2n; // 4n
-2n * 2n; // -4n
2n * 2; // TypeError: Cannot mix BigInt and other types, use explicit conversions
2 * 2n; // TypeError: Cannot mix BigInt and other types, use explicit conversions
2n * BigInt(2); // 4n
Number(2n) * 2; // 4
| ECMAScript 2027 LanguageSpecification # sec-multiplicative-operators |
| Web Proxy Viewer | New URL | Original Page |