HomeSoftware DevelopmentJavascript The rest Project Operator - GeeksforGeeks

Javascript The rest Project Operator – GeeksforGeeks


Enhance Article

Save Article

Like Article

Enhance Article

Save Article

The The rest Project Operator in javascript is represented by “%=”.  This operator is used to divide the worth of the variable by one other operand and assign the rest to the variable which is the primary operand. This may be additionally defined as assigning the rest to the primary operand which is obtained by dividing the variable from the second operand.

Syntax: 

x %= y 
or
x = x % y

Instance 1: On this instance, we’ll use the rest operator.

Javascript

let a = 17;

console.log(a %= 2);

console.log(a %= 0);

console.log(a %= 'bar');

 

Instance 2: On this instance, we’ll going to see using the rest operator.

Javascript

let a = 28;

a %= 7;

console.log(a);

  

let b = NaN;

b %= 2;

console.log(b);

We now have an entire checklist of Javascript Project Operators, Please verify this text Javascript Project Operator.

Supported Browser:

  • Chrome 1
  • Edge 12
  • Firefox 1
  • Opera 3
  • Safari  1
RELATED ARTICLES

Most Popular

Recent Comments