0

Need help in javascript

So i made this code in html and css but im not totally sure how to use javascript.. what i want to make is a button that would make the container with the class 'text' to change the text. What i think should be done is an array with the texts and define an integer so it determines the index of the array and using that you just add 1 or subtract 1 from the index.. im not totally sure how to explain it. Any ideas?

11th Jan 2020, 10:19 AM
Vlad
Vlad - avatar
3 Answers
+ 3
I was bored. Something like this? https://code.sololearn.com/W3sPT82uYzE0/?ref=app
11th Jan 2020, 10:25 AM
Russ
Russ - avatar
+ 1
Yess exactly. Thank you so muchh. what is "let" used for?
11th Jan 2020, 1:36 PM
Vlad
Vlad - avatar
0
let is just another way of declaring a variable. The main difference from var is that let only has block/function scope whereas var has global scope. On reflection, he var in the code could have been let instead, and each let could have been const. const is similar to let in that they have the same scope but a const can't be amended after it has been set.
11th Jan 2020, 2:21 PM
Russ
Russ - avatar