Edit in JSFiddle

var f = function(arg) {
    if(arg != null){
        document.write(arg); 
        document.write("<br/>"); 
    }else{document.write("<br/>");}
};
// the keyword this applies to owner of the function
var f1 = function(){
    f(this); // window object is this
}();

var data = {
    name: "abc",
    dowork: function(){
        f(this); //will represent the data object
        f(this.name); // this can be used to access the data object
    }
};
data.dowork();
var f2 = data.dowork.bind(this); // bind lets you change the context in which function will be run
f2(); // because we used bind, f2 will output this = window

//closure and scope
f();
var x = 1;
var f3 = function(){
    var y = x; // (closure) this function creates a closure around x which means that x wont get garbage collected so that f3() can be used later when needed.
    f(y);
    // (scoping) only thing that creates scope in javascript is functions. y cannot be accessed out of this function because a scope has been created around it by function f3.
};
f3();

//namespaces
//namespace is nothing but an empty object
var myns = myns || {};
myns.f4 = function(){
    f();f("something");
}();