Game Lab Documentation

Multiply operator

Category:Math

All programming languages support the basic arithmetic operations of addition, subtraction, multiplication and division of numbers.

Examples

Example: Multiply two numbers

console.log(3*5);
var x=3;
var y=5;
console.log(x*y);

Syntax

num1 * num2;

Parameters

NameTypeRequired?Description
num1any

The operands can be a number, or a variable containing a number, or the number returned by a function, or the numeric result of the evaluation of an expression.

num2any

Same as num1 but serves as the multiplicand of the expression.

Returns

A number, the result of multiplying two numbers.

Tips

  • Operator precedence is the same as standard arithmetic - Expressions within a parentheses have the highest precedence, then multiplcation and division, then addition and subtraction.

Found a bug in the documentation? Let us know at support@code.org.