What are these lines doing?

Posted by Montecristo on Stack Overflow See other posts from Stack Overflow or by Montecristo
Published on 2010-04-29T22:25:03Z Indexed on 2010/04/29 22:27 UTC
Read the original article Hit count: 236

I'm starting learning javascript for a project, I've found a script that does a part of what I need to do, I'd like to know how it works, both for me and in case it needs to be modified.

Originally it was used inside the page, now I've put it in a file on its own and does not work anymore, so I'm dividing it in parts, because I fail to get the whole thing.
Here is what bother me most for now:

1) Is this a declaration a function? What is its name? How can it be invoked?

(function() {
    //some code
})();

2) No clue of what is going on here

var VARIABLE = VARIABLE || {};

3) Am I defining a the implementation of methodCall here? Something like overriding a method in Java?

VARIABLE.methodCall = function(parameter) {
    console.log("parameter was: " + parameter);
};

Thank you in advance for your help.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about beginner