efine a JavaScript comparator function named rossorder with 2 parameters. Both parameters will be objects. Each object will have 3 keys: "points", "goals", and "games". T alue paired with each key will be a Number. Each object represents an NHL player. Since rossOrder is a comparator function, it must return a Number as follows: • a negative value - indicating that the value of the first parameter comes before the value of the second parameter • a positive value - indicating that the value of the first parameter comes after the value of the second parameter • zero-indicating that the values of the two parameters appear at the same location in the order. o determine how the objects should be ordered, rossOrder should use the following rules (based upon the NHL's Ross Trophy): • when the objects have different values for "points", the object with fewer points comes first; • when the objects have the same number of points but unequal values for "goals" key, the object with fewer goals comes first; • when the objects have equal points and goals, the objects are equivalent. ample test cases: et mcdavid = {"points": 64, "goals": 22, "games": 43}; et draisaitl= {"points": 64, "goals": 23, "games": 43); et madeup= {"points": 64, "goals": 22, "games": 45}; ossOrder (mcdavid, madeup) would evaluate to 0 ossOrder (draisaitl, mcdavid) would evaluate to any Number greater than 0 ossOrder (madeup, draisaitl) would evaluate to any Number less than 0 2. efine a JavaScript custom sorting function named rossTrophy with 1 parameter. This parameter will be an array of objects. The objects will be as described in D1. Your function
efine a JavaScript comparator function named rossorder with 2 parameters. Both parameters will be objects. Each object will have 3 keys: "points", "goals", and "games". T alue paired with each key will be a Number. Each object represents an NHL player. Since rossOrder is a comparator function, it must return a Number as follows: • a negative value - indicating that the value of the first parameter comes before the value of the second parameter • a positive value - indicating that the value of the first parameter comes after the value of the second parameter • zero-indicating that the values of the two parameters appear at the same location in the order. o determine how the objects should be ordered, rossOrder should use the following rules (based upon the NHL's Ross Trophy): • when the objects have different values for "points", the object with fewer points comes first; • when the objects have the same number of points but unequal values for "goals" key, the object with fewer goals comes first; • when the objects have equal points and goals, the objects are equivalent. ample test cases: et mcdavid = {"points": 64, "goals": 22, "games": 43}; et draisaitl= {"points": 64, "goals": 23, "games": 43); et madeup= {"points": 64, "goals": 22, "games": 45}; ossOrder (mcdavid, madeup) would evaluate to 0 ossOrder (draisaitl, mcdavid) would evaluate to any Number greater than 0 ossOrder (madeup, draisaitl) would evaluate to any Number less than 0 2. efine a JavaScript custom sorting function named rossTrophy with 1 parameter. This parameter will be an array of objects. The objects will be as described in D1. Your function
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
need help writing these two functions. they ar in two seperate images if it helps you view them.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
This cant be right.
first, first function needs to be called "rossOrder"
second, the second function requires only 1 parameter. this has 2.
Solution
by Bartleby Expert
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education