+1

# Why?

why is the number not increasing? https://code.sololearn.com/WoNreRzNKrM5/?ref=app

5/13/2021 11:53:30 AM

Alexander Sokolov

+4

var a = { b:0 } function t(a) { a.b++; return a.b; } setInterval(function(){ console.log(t(a)) }, 2000);

+2

var a = 1 //function function t(a) { while (a<5){ a++; console.log(a); } } //setInterval setInterval(function() { t(a); }, 2000);

+1

Hi! and how would you like it to increase?

+1

what do you mean? I just want to increase the number in the object through a function, but for some reason it does not work ... ðŸ˜­

+1

+1

if you want to output a sequence of numbers, use a loop inside the function. if you just want to increase a by 1, then do this: ... a++; return a

+1

and you will have 2 with enviable constancy...

+1

But how to make the number increase infinitely?

+1

use a loop where the condition will always be true. are you from India, by any chance?

+1

and codes with infinite loops are not welcome here. please do not place programs with infinite loops in the code area (code playground { })

+1

dude, no, you don't get it. First of all, what's the difference where I come from? for that matter, my profile says where I am from. secondly, I seem to have clarified my question. i want to increment a number in an object, but it does not work.

+1

Iâ€™m not going to do it on codeplayground, who even told you that?

+1

well, you increase it by an increment of 1, then insert the number 1 as a parameter into the function. you call the function and the function increases the number to 2. then you output it to the console with an interval. to constantly increase the number, use a loop. do you know what a cycle is?

+1

I just warned you. you can use this kind of code, but keep it private

0

And how to increase more than 2?

0

Yaroslav Vernigora How to increase the number in an object "a" via function arguments?

0

https://code.sololearn.com/WTOVKj9ALXGp/?ref=app

0

Naga Raju K thx, but me helped.