charcodeAt javascript 1

charcodeAt javascript

'a'.charCodeAt(0)//returns 97, where '0' is the index of the string 'a'

Here is what the above code is Doing:
1. We are creating a variable called ‘a’ and assigning it the value of the string ‘a’.
2. We are then calling the method ‘charCodeAt’ on the variable ‘a’.
3. We are passing the argument ‘0’ to the method ‘charCodeAt’.
4. The method ‘charCodeAt’ returns the ASCII value of the character at the index ‘0’ of the string ‘a’.

Similar Posts