2 Answers
New Answeryou 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'));
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message