Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Javascript ES6 4. Write a higher order function called iteratelnventory (15 pts) This iteratelnventory function returns an updated inventory array with status This iteratelnventory function

Javascript ES6

image text in transcribed

4. Write a higher order function called iteratelnventory (15 pts) This iteratelnventory function returns an updated inventory array with status This iteratelnventory function accepts two arguments an inventory array and an evaluatelnventory function The iteratelnventory function iterates over the inventory array using .forEach() and performs evaluatelnventory The evaluatelnventory function adds a status to each item based on stock count and returns the item Stock count of 3 or more the status is 'OK' Stock count of 1 to 2 the status is 'LOW' Stock count of O is OUT OF STOCK const inventory = [ { item: 'Sony PS4 Pro', price: 399.99, stock: 3 }, { item: 'Atari', price: 125.0, stock: 0 }, { item: 'Microsoft Xbox One X', price: 499.99, stock: 1 }, { item: 'Nintendo Switch', price: 299.99, stock: 4 }, { item: 'Sony PS2 Console', price: 299.99, stock: 1 }, { item: 'Nintendo 64', price: 199.999, stock: 2 }, { item: 'Sega Genesis', price: 104.0, stock: 0 } li EXPECTED OUTPUT (array of objects): { item: 'Sony PS4 Pro', price: 399.99, stock: 3, status: 'OK' }, { item: 'Atari', price: 125, stock: 0, status: OUT OF STOCK' }, { item: 'Microsoft Xbox One X', price: 499.99, stock: 1, status: 'LOW' }, { item: 'Nintendo Switch', price: 299.99, stock: 4, status: 'OK' }, { item: 'Sony PS2 Console', price: 299.99, stock: 1, status: "LOW" }, { item: 'Nintendo 64', price: 199.999, stock: 2, status: "LOW" }, { item: 'Sega Genesis', price: 104, stock: 0, status: 'OUT OF STOCK' }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

3 How supply and demand together determine market equilibrium.

Answered: 1 week ago

Question

1 What demand is and what affects it.

Answered: 1 week ago