Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JavaScript Program Create a function called Club. It will have one argument, the

ID: 3699843 • Letter: J

Question

JavaScript Program

Create a function called Club. It will have one argument, the name of the new Club. Instead of creating a new Object, it will use the special variable this and manually modify/hack it to add the property "name" which will store the club name. Run your function using new, as if your function was a Class like in JAVA / C++. Store your new object in a variable. Finally, console.log( your_variable_here instanceof Club ). This is javascript's way check the 'type' of an object.

Output:

console.log() true

Explanation / Answer

function Club(name) { this.name = name; } var club = new Club('real madrid'); console.log( club instanceof Club );

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote