map, filter & reduce [ JS Interview Qn ] Tamil | Velmurugan MG | VMG |
In this video, we'll learn about array methods map, filter, reduce & forEach with some interview questions
Topics Covered
00:31 map interview question
05:19 forEach
07:33 filter interview question
13:10 reduce interview question
High fives!
Velmurugan MG
www.velmuruganui.com/
Join me 😊
🔗 Linkedin - / velmuruganmg
📷 Instagram - / velmurugan.mg
Maybe these Javascript concepts are useful for you 🥦
null vs undefined - • null vs undefined in J...
arrow function - • 🏹 arrow function in ja...
rest and spread - • 💅🏻 rest and spread ope...
function vs block scope - • 🧱 function vs block sc...
closure - • 🏗 closures(most wanted...
currying - • 🤩 currying ( JS Interv...
traversal in array - • Explain array & traver...
Пікірлер: 5
// Interview Questions // 1. Create a list of employees and change their names in to Lowercase. const employees = ['Hari', 'Murugan', 'Aadhiran', 'Jai', 'Vel', 'John'] const usingMap = employees.map(employee => employee.toLowerCase() ) console.log('originalArray', employees) console.log('usingMap', usingMap); const lowercareEmpoyees = [] employees.forEach( (employee) => { lowercareEmpoyees.push(employee.toLowerCase()) }) console.log(lowercareEmpoyees); // 2. Create an array of employee objects with details such as name, age, years of experience, and salary. Then, filter the employees whose salary is above 25k and display their names. const employees = [ {id: 1, name: 'Hari', age:25, experience: 3, salary: 30000 }, {id: 2, name: 'murugan', age:43, experience: 13, salary: 20000 }, {id: 3, name: 'Aadhiran', age:23, experience: 1, salary: 18000 }, {id: 4, name: 'Jai', age:28, experience: 5, salary: 32500 }, {id: 5, name: 'Vel', age:27, experience: 3, salary: 12000 }, {id: 6, name: 'John', age:32, experience: 8, salary: 40000 }, ] const minSalary = 25000; const belowTwoFiveK = employees .filter( (employee) => { return employee.salary >= minSalary }) .map((employee) => console.log(employee.name) ) // 3. How to calculate all employee salary? const employees = [ {id: 1, name: 'Hari', age:25, experience: 3, salary: 30000 }, {id: 2, name: 'murugan', age:43, experience: 13, salary: 20000 }, {id: 3, name: 'Aadhiran', age:23, experience: 1, salary: 18000 }, {id: 4, name: 'Jai', age:28, experience: 5, salary: 32500 }, {id: 5, name: 'Vel', age:27, experience: 3, salary: 12000 }, {id: 6, name: 'John', age:32, experience: 8, salary: 40000 }, ] const totalSalary = employees.reduce((accumulator, employee ) => { return accumulator + employee.salary },0 ) console.log('Total Salary', totalSalary);
Bro inheritance,oops , api,class, pathi podunga JavaScript la
@velmuruganmg
2 ай бұрын
Sure.
Clear explanations. Thank you so much bro.Please keep doing interview questions. I am preparing for my front end dvlper interview.
@velmuruganmg
22 күн бұрын
Happy to help you practice more interview questions 😊