Skip to content
Advertisement

Why am I getting an error when I try to create the Scoreboard object with an array?

JavaScript

The last line in this is giving me an error and I’m not sure why because those are the parameters for the Scoreboard class.

Advertisement

Answer

Short answer

Change to:

JavaScript

Longer answer

Consider the code:

JavaScript

You are not doing the incorrect

JavaScript

So as you know, there is no necessity to pass the variable type as well as the value, and in fact doing so is not only unnecessary but wrong.

Tip

To make you code more concise you may consider writing the code as follows, eliminating the unnecessary variable names.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement