Looping through variables [solved]

I am trying to code my site but I keep getting a “TypeError: $w(…).hide is not a function” error. Can anyone spot what I am doing wrong? I have a bunch of #html in sepquence that I am trying to hide based on a dropdown selection. I am trying to convert:

$w(“#htmlLD1”).hide();
$w(“#htmlLD2”).hide();
$w(“#htmlLD3”).hide();
$w(“#htmlLD4”).hide();

Into:
let myArray = [“1”, “2”, “3”, “4”];
for(let i = 1; i < myArray.length; i++){
let htmlstr = “"#htmlLD”+ i + “"”;
console.log(htmlstr)
$w(htmlstr).hide();
}

let htmlstr = `#htmlLD${i}`;

Also the loop condition should be:
i <= myArray.length

I knew it was something simple. Thanks!

You’re welcome (I just corrected your code, but I don’t think you really need this looping + I don’t see a point in having such an array if you don’t use it, you could just loop to a certain number without having an array that you never use)