The above string will give a out put of 12. Note that the command will count back and forward blank space also.
Counting data entered by user ( example )We ask user to enter data in a text area or text box. For our data validation or other requirements we can check the length of the data entered by the user. Here is an example if it.
We will display a text box and when user clicks the button the onclick event will trigger a function. Inside the function we will read the data entered by user and will display the number of characters.