javascript-algorithms icon indicating copy to clipboard operation
javascript-algorithms copied to clipboard

The "i" of the for loop can be initialized with the value 2

Open ghost opened this issue 2 years ago • 10 comments

The "i" of the for loop can be initialized with the value 2

ghost avatar Jan 31 '23 13:01 ghost

Hey! I am new to open source, I want to take up the issue can you please guide me a bit. Can you please assign me to this task.

BamaCharanChhandogi avatar Feb 03 '23 12:02 BamaCharanChhandogi

can you specify in which for loop the value of 'i' should be 2 ?

ShivamPandey00 avatar Feb 07 '23 12:02 ShivamPandey00

for (var i = 2; i < 10; i++) { console.log(i); }

This for loop will start with i equal to 2, and will continue until i is less than 10. On each iteration of the loop, the value of i will be logged to the console.

Skilly55 avatar Feb 13 '23 06:02 Skilly55

@phcmiguez hey i want to contribute to this project.

BamaCharanChhandogi avatar Feb 13 '23 07:02 BamaCharanChhandogi

Can I declare my variable before the for loop statement?

Dumte avatar Feb 16 '23 05:02 Dumte

yes you can

PrakarshSingh5 avatar Feb 25 '23 05:02 PrakarshSingh5

Hey yes you can declare it as an I or as any other name but as we have studied was always I and one thing more you can give any value to it ,

Ahamdzia avatar Feb 28 '23 03:02 Ahamdzia

Hey, is this issue still opened

utkarsh-shrivastav77 avatar May 12 '23 10:05 utkarsh-shrivastav77

You can initalize i value with 2. If you initialize I with 2 then the loop will start with the i value of 2.

If you use for loop like this ,

for (var i = 2; i < 50; i++) { console.log[i] }

you get all the number from 2 to 49.

pasan2002 avatar Mar 20 '24 11:03 pasan2002

can you specify in which for loop the value of 'i' should be 2 ?

miladhatami1393 avatar May 23 '24 07:05 miladhatami1393