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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started