javascript duplicate an element code example
Example 1: how to check for duplicate syntax in javascript
let strArray = [ "q", "w", "w", "w", "e", "i", "u", "r"];
let findDuplicates = arr => arr.filter((item, index) => arr.indexOf(item) != index)
console.log(findDuplicates(strArray))
console.log([...new Set(findDuplicates(strArray))])
Example 2: javascript duplicate an array
let arr =["a","b","c"];
const duplicate = [...arr];
const duplicate = Array.from(arr);
Example 3: js clone element
let newClone = node.cloneNode([deep])
let p = document.getElementById("para1")
let p_prime = p.cloneNode(true)