Need some help with Javascript


#1

exercies 5 controlling the loop.

I don't understand what I must do I read the text on the left side I few times but can't find the solutuion.
I would appreciate some help

Thanks Dylan


#2

i++ is a shorthand for i += 1 which is a shorthand for i = i + 1

But you don't want to increase your loop in steps of one, you want to increase your loop in steps of 5. So you might want to change i++ to something more suitable for your situation


#3

like i = i + 5???


#4

yea, sounds like a good idea :slight_smile: You should try it


#5

I tried didn't work I need another solution


#6

do you have another solution?


#7

Well, the numbers you want are:
0, 5, 10, 15, 20, 25, 30 and 35. So you might want to change the starting point (change i = 5 so it start at zero) and change i < 51 that it stops after 35.


#8

I have this now but it are steps of 6


#9

oops I crasht the page


#10

i+=5 should be inside the for loop declaration , where currently i++ is. You want your loop to take steps of 5, right? Yes, you can change update the counter inside the actual loop, but that is not what you want here. Oops, your loop still continues after it printed 35, change i < 51 so it stops after 35


#11

thanks it works html was easy but js....


#12

html is a markup language, which makes it a great starting language because it easy. JS is a scripting language, which means there will be more programming logic, making it more difficult, don't worry, you will get the hang of it :slight_smile: I started from scratch at some point as well :slight_smile: Never forget that, everyone started from scratch