10 Methods That Every JavaScript Developer Should Know

Abdullah AL Habib
1 min readMay 5, 2021


Javascript Array and String are great data structures for every js programmer. So, I am trying to describe 10 useful Things of the javascript array and string.

  1. Declare an Array
let arr = new Array()orlet  arr = [];

2. Check if an Object is Array


3. Check What character at the selected position with charAt() method

let bookName = ‘Learn Js in 10 Days’;
console.log(bookName.charAt(2)); // prints o

4. Make 2 String to 1 String using concat()

let firstName = 'Abdullah AL';
let lastName = 'Habib';
let fullName = firstName.concat(' ', lastName);
// Output: Abdullah AL Habib

5. Check if the String ends with a sequence of characters with the endsWith() method.

let firstName = 'Abdullah AL';
console.log(firstName.endsWith('al')); //Output: True

6. Convert the String to Lower Case using toLowerCase()

let firstName = 'Abdullah AL';
console.log(firstName.toLowerCase()); //Output: abdullah al

7. Convert the String to Upper Case using toUpperCase()

let firstName = 'Abdullah AL';
console.log(firstName.toUpperCase()); //Output: ABDULLAH AL

8. Find the index of any object from Array using the indexOf() method

let arr = ['CSE', 'SWE', 'CIS', 'ITM']console.log(arr.indexOf('SWE')); //Output: 1

9. Add an object to the last of an array using push()

let arr = ['CSE', 'SWE', 'CIS', 'ITM']
console.log(arr.length); //Output: 5

10. Remove last element from array using pop()

let arr = ['CSE', 'SWE', 'CIS', 'ITM']
console.log(arr.length); //Output: 3