charCodeAt method can be used with both standard strings defined with single or double quotes and String objects or literal templates.
charCodeAt(1) // 97
If there is no character in the position we pass as parameter to the method, the returned value will be NaN. This case will occur when we want to obtain the code of the character that is in a position whose value is equal to or greater than the length of the string. The NaN value means Not a Number, returned when the result obtained is not a numeric value.
charCodeAt(20) // NaN
charCodeAt method works in exactly the same way with String objects, as you can see in the following example
charCodeAt(1); // 97
In addition, you can use the toString method with the result obtained by the
charCodeAt method to convert the Unicode code into a character.
In case you want to get the representation of special characters whose representation consists of two 16-bit units, you have to use the
charCodeAt method twice, with two consecutive indices. Alternatively, you can also use the codePointAt method. Alternatively, you can also use the codePointAt method. For more information about this method, see how to use the
Licenciada en Bellas Artes y programadora por pasión. Cuando tengo un rato retoco fotos, edito vídeos y diseño cosas. El resto del tiempo escribo en MA-NO WEB DESIGN AND DEVELOPMENT.
In the first part of this series, we explored the fundamentals of the Payment Request API and how it simplifies the payment experience. Now, let's delve deeper into advanced features…
The Payment Request API has emerged as the new standard for online payments, transforming the way transactions are conducted on the internet. In this two-part series, we will delve into…
A sleep()function is a function that allows you to stop the execution of code for a certain amount of time. Using a function similar to this can be interesting for…
I have long wanted to talk about how infinite scroll functionality can be implemented in a list of items that might be on any Web page. Infinite scroll is a technique…
JWT tokens are a standard used to create application access tokens, enabling user authentication in web applications. Specifically, it follows the RFC 7519 standard. What is a JWT token A JWT token…