0
Duplicate commands
How to remove duplicate commands without equalizing variables, if it's possible https://code.sololearn.com/Wuxqz69rNhcy/?ref=app
2 Antworten
+ 3
you can do:
let b = a.cloneNode();
let c = a.cloneNode();
or you can initialize a list of element:
let [a, b, c] = [...Array(3)].map(() => document.createElement('input'));
you could also create a new function to shorter the writing:
let create = document.createElement.bind(document);
let [a, b, c] = [...Array(3)].map(() => create('input'));
+ 1
visph Thanks