what is the actual syntax for the for loop? what I want to do is to calculate 2 number variables inside a function using a for a loop. I am going over and over the internet and I cannot find anything that can help me specifically for this task I was given to do. I am not looking for the answers, just for a guideline or a hint. or just give me the syntax and I will try my best to adjust it to my needs. just so you have a better understanding of the task, here it is.
Features
Instead of hardcoding Y (the result of the Fibonacci of X), calculate it with a for loop
The calculation should be wrapped in a function, that gets X as an argument, and returns Y
After the function, you should call the function, and assign the returned value in your HTML to present to the user
btw, i know that i did not put the innerHTML correcly, and also i did not do the syntax right, this is actually what i am asking here.
thank you!!
i have tried this:
var answer = document.getElementsByClassName("paragraph")
function calc (x){
for (let a = 2; a <= x; a++){
answer = document.textContent("this is a pr")
}
return calc
}
calc(2)