3 Useful JavaScript Array Methods
I am final year computer science engineering student proficient in Flutter, NodeJS and SQL (MySQL and PostgreSQL). I have interned as Flutter App development and backend is my current field of interest. I love getting introduced and learning new technologies that are changing the world around us.
Objective
In todays blog we will discover some useful JavaScript Array Methods.
concat()
Concatenates two arrays:
const arr1 = ["Hi", "Everyone"];
const arr2 = ["I", "am", "Asim"];
const children = arr1.concat(arr2); // ["Hi", "Everyone", "I", "am", "Asim"]
every()
Checks if every element in an array pass a test
const ages = [32, 33, 16, 40];
ages.every(checkAge)
function checkAge(age) {
return age > 18;
}
filter()
Creates a new array with every element in an array that pass a test
const nums = [-1, 6, 8, -7];
const result = nums.filter(checkPositive);
function checkPositive(num) {
return num > 0;
}



