0

I didn't understand this code the result is 0 but I didn't understand the algorithm

var arr =[]; var x= 80 % 70; var y= 0; for (i=0;i<x;i++); if(i%3===0) y=arr.push(i); console.log(y)

29th Aug 2019, 5:13 PM
Chamseddine Louhmadi
Chamseddine Louhmadi - avatar
6 Réponses
0
% sign mean mode X will be 10 value After for loop; that means loop work for empty statement. If (10%3===0) This condition become false So Y remain zero.
29th Aug 2019, 5:20 PM
yogesh lodha
yogesh lodha - avatar
0
And what does it mean push and arr
29th Aug 2019, 5:23 PM
Chamseddine Louhmadi
Chamseddine Louhmadi - avatar
0
This line will not execute. this line means add y value to array
29th Aug 2019, 5:25 PM
yogesh lodha
yogesh lodha - avatar
0
And the array it 0 so y equal 0 also
29th Aug 2019, 5:28 PM
Chamseddine Louhmadi
Chamseddine Louhmadi - avatar
0
Console.log Display y value. Var y=0 Set y mean 0
29th Aug 2019, 5:31 PM
yogesh lodha
yogesh lodha - avatar
0
Thank you
29th Aug 2019, 5:32 PM
Chamseddine Louhmadi
Chamseddine Louhmadi - avatar