Public Questions for tag [loops]

Ask Question

3 questions


0

Vote

5

Answers

31

View

How do I access the index in a for loop like the following?ints = [8, 23, 45, 12, 78] for i in ints: print('item #{} = {}'.format(???, i))I want to get this output:item #1 = 8 item #2 = 23 ite

Jan 18

0

Vote

3

Answers

40

View

I have a JavaScript object like the following:var p = { "p1": "value1", "p2": "value2", "p3": "value3" };Now I want to loop through all p elements (p1, p2, p3...) And get their keys an

Jan 16

0

Vote

3

Answers

27

View

How can I loop through all the entries in an array using JavaScript?I thought it was something like this:forEach(instance in theArray)Where theArray is my array, but this seems to be incorrect.

Dec 31