let arr = [“2”, “4”, “6”, “8”, “10”, “12”, “14”, “16”, “18”, “20”, “22”, “24”, “27”, “30”, “33”, “36”, “42”, “48”, “54”, “60”] var rr = []; function name(n) { let num = Number(n); for (let i = 0; i < arr.length; i ) { const element = arr[i]; if(element!=num){ rr.push(num–); } } return rr.find((el)=>{ let newel = String(el); return arr.includes(newel); }) } let newn = String(name(“56”));
console.log(newn);
更多内容请见原文,原文转载自:http://www.mark-to-win.com/tutorial/50905.html