JS Built-ins
Operatorsbeginner

Operators β€” arithmetic: +, -, *, /, %, **

Arithmetic operators

JavaScript supports the usual arithmetic operators. % is remainder (not modulo), and ** is exponentiation.

Challenge: Write arithmetic(a, b) that returns an object with properties add, sub, mul, div, mod, pow representing each operation.

πŸ’‘ Hints (1)
  • β€’ ** is the exponentiation operator (ES2016)