Question: This needs to be written in JavaScripy Also I need an explanation of what he's actually asking as well as the code written Let CourseItem

This needs to be written in JavaScripy Also I need an explanation of what he's actually asking as well as the code written

Let CourseItem be a function that takes a single argument called props. Inside the function use the typeof operator to check if the type of props is 'object'. If it is an object then print each key, value pair on a separate line using console.log. If props of type 'string' then it should print it as is and immediately return. In case props is an object and has a year property, then, return an object that has the year as the key whose value is an object with the rest of the key-value pairs of props. For example the return value for the about data would be { '2021' : { 'course_id' : 'CSC441', 'section': 'H001', etc } }. Other than a year and a corresponding value, I will use totally different key-value pairs to test your code. In other words, you cannot assume that the props I pass would have a key called course_id or a value 'CSC441

Pass all the variables initialized above in a single call to CourseItem without changing the number of parameters the function takes. Make sure that the function prints the variable name and its value one per line.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!