Skip to content
Advertisement

Can’t get eventListener to display value in console

Hey guys im new to javascript and trying to get a better understanding of it, i am trying to make a 8 ball project and currently just to see if it works get it to display in the console but all i recieve is that it is undefined

JavaScript
JavaScript
JavaScript

Advertisement

Answer

There are a number of issues in your code:

  • You are missing the parenthesis to call randomNumber here:

    JavaScript
  • Math always starts with uppercase:

    JavaScript
  • It looks like you want predictions to be an array with multiple string elements. Instead, you have a single element with commas in it:

    JavaScript

With everything fixed:

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