Python equivalent of JavaScript map, reduce, filter Last Updated : 05 Aug, 2025 Comments Improve Suggest changes Like Article Like Report When we write code in Python, we often use functions like reduce, map, and filter to work with collections like lists. These functions help us perform operations on each item in the collection in a clean and efficient way. JavaScript also provides similar functionality, and today we will explore how we can do the same tasks in JavaScript.Table of Contentmap in JavaScriptfilter in JavaScriptreduce in JavaScriptmap in JavaScriptIn Python, we use map to apply a function to every item in a list and return a new list. JavaScript has a similar method called map. Python lst = [1, 2, 3] result = list(map(lambda x: x * 2, lst)) print(result) Output[2, 4, 6] JavaScript let arr = [1, 2, 3] let result = arr.map(a => a * 2) console.log(result) filter in JavaScriptThe filter function in Python helps us keep only those items in a list that meet a certain condition. JavaScript has a filter method that does exactly the same thing. Python lst = [1, 2, 3, 4] result = list(filter(lambda x: x % 2 == 0, lst)) print(result) Output[2, 4] JavaScript let arr = [1, 2, 3, 4] let result = arr.filter(a => a % 2 === 0) console.log(result) reduce in JavaScriptPython’s reduce function is used to reduce a list to a single value. In JavaScript, reduce does the same job. It takes a function that is applied to every element, and it returns a single value. Python from functools import reduce lst = [1, 2, 3, 4] result = reduce(lambda x, y: x + y, lst) print(result) Output10 JavaScript let arr = [1, 2, 3, 4] let result = arr.reduce((a, b) => a + b, 0) console.log(result) The reduce method takes a function with two arguments, a and b. It applies the function to each element in the array and combines the results into a single value.The second argument to reduce (0 in our example) is the initial value. Without it, the first element of the array is used as the initial value. Comment More info P pragya22r4 Follow Improve Article Tags : Python python Python vs JavaScript Explore Python FundamentalsPython Introduction 3 min read Input and Output in Python 4 min read Python Variables 5 min read Python Operators 5 min read Python Keywords 2 min read Python Data Types 8 min read Conditional Statements in Python 3 min read Loops in Python - For, While and Nested Loops 7 min read Python Functions 5 min read Recursion in Python 6 min read Python Lambda Functions 5 min read Python Data StructuresPython String 5 min read Python Lists 5 min read Python Tuples 4 min read Python Dictionary 3 min read Python Sets 6 min read Python Arrays 7 min read List Comprehension in Python 4 min read Advanced PythonPython OOP Concepts 11 min read Python Exception Handling 5 min read File Handling in Python 4 min read Python Database Tutorial 4 min read Python MongoDB Tutorial 2 min read Python MySQL 9 min read Python Packages 12 min read Python Modules 7 min read Python DSA Libraries 15 min read List of Python GUI Library and Packages 3 min read Data Science with PythonNumPy Tutorial - Python Library 3 min read Pandas Tutorial 6 min read Matplotlib Tutorial 5 min read Python Seaborn Tutorial 15+ min read StatsModel Library- Tutorial 4 min read Learning Model Building in Scikit-learn 8 min read TensorFlow Tutorial 2 min read PyTorch Tutorial 7 min read Web Development with PythonFlask Tutorial 8 min read Django Tutorial | Learn Django Framework 7 min read Django ORM - Inserting, Updating & Deleting Data 4 min read Templating With Jinja2 in Flask 6 min read Django Templates 7 min read Python | Build a REST API using Flask 3 min read How to Create a basic API using Django Rest Framework ? 4 min read Python PracticePython Quiz 3 min read Python Coding Practice 1 min read Python Interview Questions and Answers 15+ min read Like