let nums =[2,7,7,11,15] let nums1=[] let target=9 let z=[] var mp = new Map(); for(let i = 0; i < nums.length; i++){ let x=target-nums[i] if(nums.includes(x)){ console.log(x,i) // break } z.push(x) }