How to find duplicate number in the given array.?
let data = [100,2000,8,2,90000,8] // let res = new Set(data) let res = data.filter((ele, index, arr)=>arr.indexOf(ele)!==index)
Search for a command to run...
Articles tagged with #frontend-development
let data = [100,2000,8,2,90000,8] // let res = new Set(data) let res = data.filter((ele, index, arr)=>arr.indexOf(ele)!==index)
const arr = [2, 8, 7, 9] const largetValue = (arr) => { let firstLargetValue = Math.max(...arr) index = arr.indexOf(firstLargetValue) arr.splice(index, 1) let secondLargetValue = Math.max(...arr) return (secondLargetValue) } conso...
Local Storage Local storage is used to persist data in the browser level. Data is not lost even after the browser is closed, or even after the OS is rebooted. It has 5MB of memory capacity. Local storage has four methods: setItem: localStorage.setIte...
let n = 15; let count = 0; while (n != 0) { n = n & n << 1 count++ } console.log(count)