Message from JavaScript discussions

November 2020

— Can you perhaps upload an example somewhere?

— 

I recommend a https://neocities.org/ free account if you do not have any sort of hosting. Unless you do not wish to public whatever you are working on publically.

— Mh, would be quite troublesome, i cannot disclose it, so I'd need to spend a lot of time in making a mockup-version.
If it works the same, here's Slick's demo: http://kenwheeler.github.io/slick/

Anyway, tinkering with alerts, I've seen that the main problem with the piece of code I posted earlier was due to the for(), although I copy-adapted the code from JS' online documentation.
Running as is, it does a variable number of iterations (dunno what makes it vary) at every mutation, and the value of mutation.target.classList remains the same every single time.

Message permanent page

— Is that because the classList of the referenced mutation target hasn't changed?

— No u don't

— Jk

— Can anyone recommend some starters on Deno? (+TS)

— Is this considered good practice?

document.querySelectorAll(".class").forEach((el) => {
el.addEventListener("click", function () {
let existing = document.querySelector("#redBorder");
if (existing != null) {
existing .id = "";
}
this.id = "redBorder";
});
});

Message permanent page

— Do you have multiple elements with the id "redBorder"?

— No, only one

— Basically its just for adding a border to one element at the time

— Any idea why document.querySelector("div a") returns an array (or at least looks like an array) of four elements (the same, just repeated four times), instead of just the first matching element?

Message permanent page