computeObjects([objects], func) This method will take in an array of objects and a function, and will return one object. You must check that each value is a number type. You will evaluate the function on the values of the object, if multiple objects have the same key, you will add that value to the current value. The return object will not have any duplicated keys. Example: const first = { x: 2, y: 3}; { a: 70, x: 4, z: 5 }; const third = { x: 0, y: 9, q: 10 }; const second

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

please begin with

computeObjects([objects], func) 

using javascript

computeObjects([objects], func)
This method will take in an array of objects and a function, and will return one object.
You must check that each value is a number type. You will evaluate the function on the
values of the object, if multiple objects have the same key, you will add that value to the
current value. The return object will not have any duplicated keys.
Example:
const first
const second
{ x: 2, у: 3};
{ а: 70, х: 4, z: 5 };
{ x: 0, у: 9, q: 10 };
const third
const firstSecondThird
//{ х: 12, у: 6, а: 140, z: 10 }
// x =
computeObjects([first, second], x => x * 2);
(2 * 2) + (4 * 2)
• You must check to make sure an array is supplied as an input parameter
• You must check that an array of objects is supplied, if one or more elements in the
array is NOT an object, you will throw an error.
• You must check that each object is not an empty object ; if any are empty, you must
throw an error.
Transcribed Image Text:computeObjects([objects], func) This method will take in an array of objects and a function, and will return one object. You must check that each value is a number type. You will evaluate the function on the values of the object, if multiple objects have the same key, you will add that value to the current value. The return object will not have any duplicated keys. Example: const first const second { x: 2, у: 3}; { а: 70, х: 4, z: 5 }; { x: 0, у: 9, q: 10 }; const third const firstSecondThird //{ х: 12, у: 6, а: 140, z: 10 } // x = computeObjects([first, second], x => x * 2); (2 * 2) + (4 * 2) • You must check to make sure an array is supplied as an input parameter • You must check that an array of objects is supplied, if one or more elements in the array is NOT an object, you will throw an error. • You must check that each object is not an empty object ; if any are empty, you must throw an error.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY