Fundamentals of JavaScript

(1) charAt():

This is a string objects method that returns a new string

syntax — let character = str.charAt(index)


const sentence = ‘My name is Mowmita Ahmed.’;

const index = 4;


(2) concat()

This is a string method that returns a new string of concatenated string arguments of the calling string.


const str1 = ‘Mowmita’;
const str2 = ‘Ahmed’;

console.log(str1.concat(‘ ‘, str2));
// expected output: “Mowmita Ahmed”

(3) slice()

It’s a string method which returns a new string after extracting it without modifying the original sentence.

Syntax — str.slice(beginIndex[, endIndex])


const str = ‘My name is Mowmita Ahmed Chowdhury.’;


(4) endsWith()

It’s a string method that determines whether a string ends with the character of specified string .It returns true or false.

Syntax- str.endsWith(searchString[, length])


const str1 = ‘Girls are the best!’;

console.log(str1.endsWith(‘best’, 17));

(5) isNaN()

It’s a string method that determines whether the value is number or not.

Syntax- Number.isNaN(value)

Example: Number.isNaN(y)

(6) Math.ceil()

This is a function which returns the next largest number.

Syntax- Math.ceil(x)

Example: console.log(Math.ceil(2.83));

(7) Math.floor()

This is a math function which returns the largest integer less than or equal to a given number.

Syntax — Math.floor(x)

Example: console.log(Math.floor(-1.09));

(8) Math.min()

This is a math function which returns the lowest valued number.

Syntax- Math.min([value1[, value2[, …]]])


console.log(Math.min(24, 31, 18));

(9) filter()

This function create a new array with all elements which pass the conditions of the function

Syntax- let newArray = arr.filter(callback(currentValue[, index, [array]]) {
// return element for newArray, if true
}[, thisArg]);


const words = [‘momo’, ‘mowmita’, ‘tamim’, ‘momi’, ‘Tanha’];

const result = words.filter(word => word.length > 4);

(10) find()

This method returns the value of the first element which pass the test condition of the function.

Syntax- arr.find(callback(element[, index[, array]])[, thisArg])


const tama2 = [7, 17, 28, 15, 55];

const fing= tama2.find(element => element > 12);



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store