Last active
December 6, 2016 21:48
-
-
Save jgrant29/561c65988c381f97158ce2e855ddf594 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JavaScript | |
Hey mentor, | |
I was working through an assignment last night and came across a bug. I'm so confused! | |
The text in the alert is showing up as "undefined" instead of either "A Unicorn", "A hug", or "Fresh Laundry" and I'm not quite sure what's going on. Can you point me in the right direction? | |
-Student |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey Student,
Put the event handler inside a closure, otherwise btnNum will always be the last one by the time the button is clicked.
Button 1!
Button 2!
Button 3!