I'm having really hard to really grasp everything about the this object in javascript. I've been trying with tutorials but I haven't found a really good one. I mean, if I have a function which executes some code and then in the end I return "this" what exactly do I then return?
gunnarflax
0
Junior Poster
Recommended Answers
Jump to PostI'm having really hard to really grasp everything about the this object in javascript. I've been trying with tutorials but I haven't found a really good one. I mean, if I have a function which executes some code and then in the end I return "this" what exactly do I …
Jump to PostGunnarflax,
Most object-oriented languages have Classes; reusable blocks of code which define a named collection of properties and methods.
Once a Class is defined, one or more instances thereof can be created with a code statement, typically of the form
foo = new Bar(param1, param2 ....)
;, where …
Jump to PostBut if I have an anchor with onmouseover="function(this)" it would then send the anchor element itself to the constructor right? But if in the function alert(this) I receive "[object Object]" instead of the correct html element. Why is this?
Because
this
only refers to the anchor element in the …
All 10 Replies
Troy III
272
Posting Pro
Airshow
416
WiFi Lounge Lizard
Team Colleague
gunnarflax
0
Junior Poster
Airshow
416
WiFi Lounge Lizard
Team Colleague
gunnarflax
0
Junior Poster
Airshow
416
WiFi Lounge Lizard
Team Colleague
Troy III
272
Posting Pro
gunnarflax
0
Junior Poster
Airshow
416
WiFi Lounge Lizard
Team Colleague
vsmash
14
Dinosaur
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.