How to get the index of specific string in array of strings in Node.js

1 Answer

0 votes
const array = ['c++', 'node.js', 'c', 'java'];
const s = 'node.js';
 
console.log(array.indexOf(s)); 
 
 
 
 
 
 
/*
run:
 
1

*/

 



answered Feb 5, 2022 by avibootz
...