Let's first look at the basic syntax of the charAt function
The charAt function's only argument is the index in the string from which to extract a single character. This index ranges between 0 and length - 1, inclusive. If index is not specified, the first character of the string is returned because 0 is the default index used for this function. The function returns the single character located at the index specified as the function argument. If the index is out of range, this function returns an empty string. Let's take a look at the specific example of the charAt function The code is as follows <!DOCTYPE html> <html> <head> <title></title> </head> <body> <script> function func() { var str = 'JavaScript is an object oriented language'; var value = str.charAt(9); document.write(value); } func(); </script> </body> </html> The output is as follows: The above content is very simple. Thank you for your reading and support of 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed explanation of JavaScript WebAPI, DOM, events and operation element examples
>>: Install MySQL in Ubuntu 18.04 (Graphical Tutorial)
1.docker search mysql查看mysql版本 2. docker pull mys...
Table of contents Problem Description Front-end c...
Table of contents Where are the logs stored? View...
1. According to the online tutorial, the installa...
BEM from QQtabBar First of all, what does BEM mea...
The problems and solutions encountered when deplo...
1. Introduction Recently, I helped a friend to ma...
Table of contents 1. Function signature 2. Functi...
1. Install MySQL software Download and install My...
CentOS 8 changed the software package installatio...
This article uses examples to illustrate the prin...
Table of contents $nextTick() $forceUpdate() $set...
This article uses examples to illustrate the basi...
Table of contents 1. classList attribute 2. Pract...
1. Project Documents 2. Use HTML and CSS for page...