Contact: aviboots(AT)netvision.net.il
41,195 questions
53,691 answers
573 users
const array = ['c++', 'node.js', 'c', 'java']; const substring = 'js'; const match = array.find(element => { if (element.includes(substring)) { return true; } }); console.log(match); /* run: node.js */
const array = ['c++', 'node.js', 'c', 'java']; const substring = 'js'; const index = array.findIndex(element => { if (element.includes(substring)) { return true; } }); console.log(index); /* run: 1 */