10+years of international development cooperation, now full with project ideas but mediocre skills to turn them into reality...
Main interests: ++ ag-tech ++ stem ++ gardening ++
can you explain the implicit binding a bit more? I had situations where this wouldn't function, but I couldn't find out why (not); in particular with stacked calls.
10+years of international development cooperation, now full with project ideas but mediocre skills to turn them into reality...
Main interests: ++ ag-tech ++ stem ++ gardening ++
You'll notice that JS throws a TypeError which must have something to do with the scope, I presume. I've usually found workarounds, but I do not like them. I'd like to really understand the problem.
Hi Brit,
can you explain the implicit binding a bit more? I had situations where this wouldn't function, but I couldn't find out why (not); in particular with stacked calls.
Apart from that - very helpful! :-)
All the best,
Sebastian.
Hey Sebastian, Thanks for your comment. Could you give me an example of where implicit binding didn't work for you?
Hi Brit,
sorry for the late response - I couldn't exactly remember where it happened, but now I found the problem:
Assume the following micro-example:
Here's a possible corresponding html-file:
You'll notice that JS throws a TypeError which must have something to do with the scope, I presume. I've usually found workarounds, but I do not like them. I'd like to really understand the problem.
Thanks!
Sebastian.
This is likely a scope issue. A couple of things to know about classes:
In your case point 1 is the issue - classes are not hoisted. You've created Handler below where you are invoking it.
Here's a codepen where I explain classes a little deeper. Hopefully that's helpful :)
codepen.io/BritHemming/pen/WNvYJMr