Message from JavaScript discussions

May 2019

— Like .split(' ') ?

— 

I have already used the .split method to separate classes but I need to split them as when adding more classes in the classList method

— The function requires that all the classes to be added are grouped in a string and at the beginning of the function, check if the browser supports classList. In that case I need to separate the classes into a different string for each of them

Message permanent page

— Wat

— Why are they joined like that?

— Just loop

— I have already tested the "final" variable, it works

— classes.trim().split(/\s+/g).forEach(class =>
el.classList.add(class));

— Check this
https://stackoverflow.com/questions/15138614/how-can-i-read-the-contents-of-an-url-with-python

Message permanent page

— Unexpected token, expected "{" (1:43)

> 1 | classes.trim().split(/\s+/g).forEach(class => {
| ^
2 | el.classList.add(class)});

Message permanent page

— Wat

— What kind of browser are you testing this with