Exambodh - Practice Aptitude, Reasoning & GK Questions
Play Quiz
Start practice
≡One Liner Questions⌂Home?Play QuizAaArticles
General Knowledge›
Indian History›
Indian Polity›
Quantitative Aptitude›
Logical Reasoning›
Interview Practice›
General Science›
Computer Awareness›
View more categories (4)
Current Affairs›
Geography›
NCERT Solutions & Notes›
Static GK›
  1. Home
  2. |Articles
  3. |Javascript Array Methods Reduce Filter Includes Find findindex Sort
←Back to Articles
JavascriptJavascript

Javascript Array Methods Reduce Filter Includes Find findindex Sort

Javascript17 March 20265 min read

Share Article

Share on social media or copy your public link.

FacebookWhatsAppLinkedIn
JavaScript Tips

JavaScript Array Methods: reduce(), filter(), includes(), find(), findIndex(), and sort() Explained with Examples

JavaScript arrays come with many built-in methods that make data handling easy and efficient. Instead of writing long loops again and again, developers can use array methods to filter, search, sort, and combine data quickly.

In this article, we will understand six very important JavaScript array methods: reduce(), filter(), includes(), find(), findIndex(), and sort(). These methods are commonly used in real projects, coding interviews, React applications, and API data handling.

“Mastering JavaScript array methods like reduce(), filter(), and find() helps developers write cleaner, shorter, and more efficient code.”

Expert Insight

Modern JavaScript development depends heavily on array methods. Developers who understand methods like reduce(), filter(), find(), and sort() can solve real-world problems more effectively than by relying only on traditional loops.

Why These Methods Are Important

If you work with user lists, product data, marksheets, dashboards, APIs, or search results, then these array methods will be used frequently in your code.

They help you reduce code complexity and improve readability. That is why these methods are also commonly asked in JavaScript and React interviews.

1. reduce()

The reduce() method reduces an array to a single value by applying a callback function on each element.

What it does

Combines all array elements into one final value.

Use case

Useful when you want totals, sums, summary values, or concatenation.

let emotions = ["😊", "😱", "😐"];

let allEmotions = emotions.reduce(
  (acc, emotion) => acc + emotion,
  ""
);

console.log(allEmotions);
// "😊😱😐"

Here, reduce() combines all array values into a single string.

Practical Example

let numbers = [10, 20, 30];

let total = numbers.reduce((sum, num) => sum + num, 0);

console.log(total);
// 60

2. filter()

The filter() method returns a new array containing only those elements that satisfy a given condition.

What it does

Filters array items based on a condition.

Use case

Useful when you want only specific items from a list.

let emotions = ["😊", "😱", "😡", "😐"];

let happyEmotions = emotions.filter(
  emotion => emotion === "😊" || emotion === "😐"
);

console.log(happyEmotions);
// ["😊", "😐"]

Here, filter() returns only the matching elements.

Practical Example

let numbers = [5, 10, 15, 20];

let result = numbers.filter(num => num > 10);

console.log(result);
// [15, 20]

3. includes()

The includes() method checks whether a given value exists in an array. It returns true or false.

What it does

Checks if an array contains a particular value.

Use case

Useful when you want to verify the existence of an item.

let emotions = ["😊", "😱", "😡"];

console.log(emotions.includes("😊"));
// true

console.log(emotions.includes("😐"));
// false

Here, includes() checks whether the given element is present in the array.

Practical Example

let roles = ["Admin", "Editor", "User"];

console.log(roles.includes("Admin"));
// true

4. find()

The find() method returns the first element in an array that satisfies a condition.

What it does

Returns the first matching item from an array.

Use case

Useful when you are searching for one specific item.

let emotions = ["😊", "😱", "😐"];

let firstHappy = emotions.find(
  emotion => emotion === "😊"
);

console.log(firstHappy);
// "😊"

If a matching value is found, find() returns that value. Otherwise, it returns undefined.

Practical Example

let users = [
  { id: 1, name: "Rahul" },
  { id: 2, name: "Aman" }
];

let user = users.find(u => u.id === 2);

console.log(user);
// { id: 2, name: "Aman" }

5. findIndex()

The findIndex() method returns the index position of the first element that matches a condition.

What it does

Returns the position of the first matching element.

Use case

Useful when you want to know where an item exists in the array.

let emotions = ["😊", "😱", "😐"];

let index = emotions.findIndex(
  emotion => emotion === "😐"
);

console.log(index);
// 2

Here, the matching element "😐" is found at index 2.

Practical Example

let numbers = [10, 20, 30];

let index = numbers.findIndex(n => n === 20);

console.log(index);
// 1

6. sort()

The sort() method sorts the elements of an array. It changes the original array directly.

What it does

Sorts array elements in place.

Use case

Useful when you need data in sorted order.

let numbers = [3, 1, 4, 2];

numbers.sort();

console.log(numbers);
// [1, 2, 3, 4]

Sorting Strings

let characters = ["b", "d", "a", "c"];

characters.sort();

console.log(characters);
// ["a", "b", "c", "d"]

Important Note for Numbers

For numeric sorting, it is better to use a compare function.

let numbers = [10, 2, 30, 4];

numbers.sort((a, b) => a - b);

console.log(numbers);
// [2, 4, 10, 30]

Quick Summary

  • reduce() reduces an array to a single value.
  • filter() returns items matching a condition.
  • includes() checks if a value exists in the array.
  • find() returns the first matching element.
  • findIndex() returns the index of the first matching element.
  • sort() sorts elements of an array.

Key Takeaway

If you want to become stronger in JavaScript, do not just memorise syntax. Understand where to use each method: filter() for selection, find() for searching, includes() for checking, reduce() for summarising, and sort() for ordering data.

More In Javascript

Read more articles from the same category or open the full category archive directly.

Javascript

Javascript

JavaScript ES6+ Interview Questions & Concepts (Destructuring, Spread, Rest)

Modern JavaScript is not about writing more code, it's about writing smarter code.

React js

Javascript

JavaScript Basics Explained: Variables, Data Types & Functions with Examples

“Strong fundamentals in JavaScript make you a better React developer.”

Javascript

Javascript

JavaScript Arrays Explained with Examples Part 2 (Complete Beginner Guide)

Learn advanced JavaScript array methods with simple explanations and examples. This part covers flat, flatMap, findIndex, fill, copyWithin, Array.from, Array.isArray, and more.

Javascript
Javascript

JavaScript ES6+ Interview Questions & Concepts (Destructuring, Spread, Rest)

Javascript
React js

JavaScript Basics Explained: Variables, Data Types & Functions with Examples

Javascript
Javascript

JavaScript Arrays Explained with Examples Part 2 (Complete Beginner Guide)

View All Javascript Articles→

On This Page

Introduction

Recent Posts

Debounced Search Input

How to Build a Debounced Search Input in React.js

7 May 2026

React js

React 19 Features Explained with React 18 vs React 19 Comparison

7 May 2026

Javascript

React Interview Questions and Answers 2026 | SSR, CSR, Hooks, Virtual DOM

7 May 2026

Top AI cource

AI Courses for Software Developers in 2026: Best Course, Salary & Career Path

30 March 2026

Bharat Ratna Award

Bharat Ratna Award Winners List 1954 to 2024: History, Facts and Full List

26 March 2026

Awards and Honours

Nobel Prize 2025 Winners, History, Categories, Indian Winners & Important Facts (Hindi + English)

26 March 2026

Javascript

JavaScript ES6+ Interview Questions & Concepts (Destructuring, Spread, Rest)

21 March 2026

React js

JavaScript Basics Explained: Variables, Data Types & Functions with Examples

21 March 2026

Javascript

JavaScript Arrays Explained with Examples Part 2 (Complete Beginner Guide)

20 March 2026

Javascript

JavaScript Arrays Explained with Examples (Complete Beginner Guide)

20 March 2026

Exambodh

Exambodh helps students prepare for aptitude, reasoning, GK, and verbal exams with topic-wise practice questions, simple explanations, and structured learning.

Quick Links

HomePlay QuizArticlesAbout UsContactPrivacy PolicyDisclaimerCopyright PolicyTerms & Conditions

Study Hubs

Latest ArticlesGeneral KnowledgeQuantitative AptitudeLogical ReasoningComputer AwarenessCurrent Affairs

Popular Categories

General KnowledgeIndian HistoryIndian PolityQuantitative AptitudeLogical ReasoningInterview Practice
Explore:HomePlay QuizArticlesContact

Copyright 2026 Exambodh - aptitude, reasoning & verbal practice.