Today I had very little time for code, so I wanted to do a very simple exercise: Generate a random number between 1 to 100, and in the case of JS a...
For further actions, you may consider blocking this person and/or reporting abuse
Since you're not changing the value of
randomNumberafter initialising it, you can also useconst, which is preferred overlet. (Constants are good.)I'm curious, why did you use
.textContentinstead of.innerText? Is there a difference?@kaamkiya hi again!
const/let: good point. Since I learned to program with Python first I am not used to making that distinction. I guess I should just always useconstand then just change them toletif I run into some kind of issue with that..textContent/.innerText: I actually never heard about.innerText. What I saw in some tutorials was the use of.innerHTML, but I figured that.textContentwould probably be the safer option if I'm not inserting any html tags. Do you think.innerTextwould be even better to use?I don't know, I've only seen
textContentused twice, but same withinnerText. I doubt it matters, it's likely that one is just a reference to the other.