I'm good at learning how to program and writing a code I had a very curious problem I try to make the scroll go slow when I click an anchor in the menu but it did not work when I wrote my line (comment below on the code), searching the internet I found an alternative line in which the function runs as a string and concatenates what I do not understand why to do it that way? and why does not it work the way I wrote it?
the code is as follows
for(let i = 0.1 ; i < height; i += 0.1){
// window.setTimeout(scrollTo(0, "+i")", 0) linea que yo escribi y no funciono
setTimeout("window.scrollTo(0, "+ i +")", 0.1); //linea alternativa q encontre en internet y si funciono
}