shorowitz / Dynamite

0 stars 0 forks source link

can't add event listener #9

Closed shorowitz closed 8 years ago

shorowitz commented 8 years ago

@pppetrov sorry trying to paste the code.

essentially everything works in the console, and then when I introduce jquery and dom elements, it breaks. Been trying to figure it out with others but we can't get it. will push my current code now

cuivienor commented 8 years ago

Hey @shorowitz can you provide some context. What exactly is not working

shorowitz commented 8 years ago

@pppetrov do you have time to take a look?

cuivienor commented 8 years ago

@shorowitz yep, but I just want you to first take a look at https://github.com/ga-students/wdi-nyc-bowie_students/wiki/How-To-Ask-A-Question and give me a bit more specific info. It will go a lot faster and its a great practice to get into. I know it might seem annoying but it is worth it, trust me :smiley:

shorowitz commented 8 years ago

@pppetrov

-I cannot successfully add an event listener to call my makePlay function. I have tried adding the listener on the divs outside of the constructor, and within various different positions within the constructor where makePlay resides. Depending on the location, the handler returns an error, either noting it does not know what 'this' is or what array I am referencing. The issue is definitely a problem with scope, but I can't understand it, as I have referenced the array I am trying to access successfully in other places in the constructor.

-https://github.com/shorowitz/GameProject/commit/0650ec04827a611b2b0474411409575a4e8ec2ab

in line 63, I am trying to just get the console to tell me what this.shownBlocksArray[x] is, and while it knows what x is, it claims this.shownBlocksArray is undefined.

-how can I get 'x' to serve as the index of shownBlocksArray to access the corresponding Block successfully?

***sorry for all the back and forth, and apologies if the above is confusing! need to get better at writing about code

cuivienor commented 8 years ago

:+1: