0
Q:

indexing string in javascript

var str="Hello Folks!"
var firstStringChar = str.charAt(0); //H
7

var str = "HELLO WORLD";

var res = str.charAt(0); 
2
const paragraph = 'The quick brown fox';

console.log(paragraph.indexOf('T'));
>> 0

console.log(paragraph.indexOf('h'));
>> 1

console.log(paragraph.indexOf('Th'));
>> 0

console.log(paragraph.indexOf('he'));
>> 1

console.log(paragraph.indexOf('x'));
>> 18
2
str.indexOf(searchValue[, fromIndex])
0

New to Communities?

Join the community