How to get the index of specific character in Node.js

1 Answer

0 votes
const str = 'node.js c c++';
const ch = 'e';

console.log(str.indexOf(ch));
console.log(str.indexOf('E')); 




/*
run:

3
-1

*/

 



answered Feb 6, 2022 by avibootz

Related questions

...