Skip to content
Advertisement

I’ve declared variable “x” but i did not call it, is it ok to not call variables that have values assigned?

JavaScript

In this program, the user will enter the total amount of numbers in a list. the random module will generate random numbers between 1 to 30. Then all the numbers from the list will be added together.

I’ve tried to use the variable x but it doesn’t give the results I want, does anyone know a better/simpler way of creating this program. Also, is it bad practice to create a variable and not call it?

Advertisement

Answer

Maybe this better/simpler way of creating this program

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