From a sentence or a line if we want to identify the particular position’s character then we use this method. It is a single UTF-16 code unit. Character starts from 0 and last character is str.length-1. Out of this length position return an empty string. Default position of this method charAt() is 0

const name: ‘Robert’;

conts position: 3;


output: “b”


This method agree the logic of the string to call and return new string. By this method we can combine two different set of string in a new string. Which not changes the original string but output changes into new combined string.

const word1 = “Hey”;

const word2 = “Dude”;

console.log(word1.concate(‘ ’, word2))

Output: “Hey Dude”

Another example:

let all = [“Hey”, “ ”, “Dude”, “!”]

“”.concat(…all) after that we will find “Hey Dude!”


With this method we can check if any string is in another string, output will be conditional; true or false.

const stringOne= ‘Hello John, how are you .’;

const stringTwo= ‘Hello’;

const stringThree=‘Today’

console.log(stringOne.includes(stringTwo) ? ‘true’ : ‘false’);

output will be ‘true’

console.log(stringOne.includes(stringTwo) ? ‘true’ : ‘false’);

output will be ‘false’


This method returns the index within the string from an object of the last string after that string the search string started again. Returns -1 if the value is not found.

const string1= ‘I am a full stack developer, web developer, react developer’;

const searchString = ‘developer’;
const index = string1.indexOf(searchString);

output: 18;

console.log(searchString index);

console.log(paragraph.indexOf(searchTerm, (indexOfFirst + 1)));

output: 33;


To find the last index number of the last string which string searched for, same search string can found before of that object but this method shows only the last index of the search string last time found. Returns -1 if the value is not found.

const string1= ‘I am a full stack developer, web developer, react developer’;

console.log(searchString index);


output: 50;


To find whether a string ends with the characters of a specified string ends with a string to start new characters, returning output can be true or false.

const string1 = ‘How are you’;

console.log(string1.endsWith(‘you’, 11));
output: true

const string2 = ‘How are you’;

output: false


The method cut to the called value of a section of a string and returns it as a new string, original string remains unchanged. value can be two than one then first value will be the cut off characters length and next value will be the remain string after the cut off value to stop 2nd value and will be shown as output. Value can be negative also it will be vise versa.

const string = ‘Hello dude, how are you today.’;

output: “how are you today.”

console.log(str.slice(6, 10));
output: “dude”


This method divide a string into an array with all words in a sentence or character in a word by the searched value as an array.

const string = ‘Hey! brother, how are you today’;

const words = string.split(‘ ‘);
output: “brother”

const chars = string.split(‘’);
output: “!”

const stringCopy = string.split();
output: [“Hey! brother, how are you today”]


The method determines whether a string begins with the characters of a mentioned string, output can be true or false.

const string1 = ‘Hey dude’;

output: true

console.log(str1.startsWith(‘Hey’, 5));
output: false


This method returns a part of the string, by specified index and extending for a given number of characters afterwards.

const string = ‘Javascript’;

console.log(str.substr(4, 9));
output: “script”