E
E
Ed10242015-10-12 16:06:17
JavaScript
Ed1024, 2015-10-12 16:06:17

The loop execution is interrupted after a function call, why?

The loop does not reach the end, ends on a function call

var value = "123456";
            
for (i = 0; i < value.length; i++){
    console.log(get_number_from_table_ASCII(value[i]));
}

Function - get_number_from_table_ASCII returns number
Result
9cb7fc1856c342eaaa718b2390ff2fe5.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Finom, 2015-10-12
@Ed1024

In order to avoid such problems, they came up with var. The function uses the same variable i as the loop.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question