CoffeeScript Strings- CharAt() - CoffeeScript

Description

The charAt() technique of JavaScript returns the individual of the current string that exists inside the distinct index.

Characters in a string are listed from left to proper. The index of the first character is zero, and the index of the last character is one much less than the duration of the string. (stringName_length - 1 )

Syntax

Given beneath is the syntax of charAt() approach of JavaScript. we can use the same method from the CoffeeScript code.

It accepts an integer value representing the index of the String and returns the character at the specified index.

Example

The following example demonstrates the usage of charAt() method of JavaScript in CoffeeScript code. Save this code in a file with name string_charat.coffee

Open the command prompt and compile the .coffee file as shown below.

On compiling, it gives you the following JavaScript.

Now, open the command prompt again and run the CoffeeScript file as shown below.

On executing, the CoffeeScript file produces the following output.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

CoffeeScript Topics