Hi! I've started learning writing javascript objects with literal notation...
something = {
variable: "value",
method: function(){
//code
}
}
instead of the usual syntax...
function something(){
variable = "value";
function method(){
//code
}
}
the problem is that it's hard for me to adapt procedures which I'm used to within the normal syntax for the literal notation. E.g:
example = {
variable: "whee"
}
Is this variable global or local? If it's local, how do I declare a variable globally? I also wonder if it is possible to bind events to objects from within the object? And if I'm correct - jQuery is coded this way, but how can they then make use of their selector:
$("div")
When it is an object defined with literal notation that doesn't have a constructor?
Any help is welcome, advice, links to tutorials, whatever you got! :)
Thanks!