charAt javascript 1

charAt javascript

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

Here is what the above code is Doing:
1. We are creating a variable called str and assigning it a string value.
2. We are creating a variable called firstStringChar and assigning it the value of the first character of the string str.
3. We are using the charAt() method to get the first character of the string str.

Similar Posts