Skip to main content
deleted 2 characters in body
Source Link

No. There is no difference in execution time. The difference in the two code snippets is when i gets incremented.

for(i = 0; i < max; i++) { console.log(i); } 

This first example will yield the results: 0,1,2,3,...,max-1

for(i = 0; i < max; ++i) { console.log(i); } 

This second example will yield the results: 1,2,3,...,max-1

i++ increments the value after the operation. ++i increments the value before the operation.

There is no performance difference other than the one less iteration it will make on ++i because the increment is done before the first operation

No. There is no difference in execution time. The difference in the two code snippets is when i gets incremented.

for(i = 0; i < max; i++) { console.log(i); } 

This first example will yield the results: 0,1,2,3,...,max-1

for(i = 0; i < max; ++i) { console.log(i); } 

This second example will yield the results: 1,2,3,...,max-1

i++ increments the value after the operation. ++i increments the value before the operation.

There is no performance difference other than the one less iteration it will make on ++i because the increment is done before the first operation

No. There is no difference in execution time. The difference in the two code snippets is when i gets incremented.

for(i = 0; i < max; i++) { console.log(i); } 

This first example will yield the results: 0,1,2,3,...,max-1

for(i = 0; i < max; ++i) { console.log(i); } 

This second example will yield the results: 1,2,3,...,max

i++ increments the value after the operation. ++i increments the value before the operation.

There is no performance difference other than the one less iteration it will make on ++i because the increment is done before the first operation

Source Link

No. There is no difference in execution time. The difference in the two code snippets is when i gets incremented.

for(i = 0; i < max; i++) { console.log(i); } 

This first example will yield the results: 0,1,2,3,...,max-1

for(i = 0; i < max; ++i) { console.log(i); } 

This second example will yield the results: 1,2,3,...,max-1

i++ increments the value after the operation. ++i increments the value before the operation.

There is no performance difference other than the one less iteration it will make on ++i because the increment is done before the first operation