Thursday, 1 November 2012

some javascript interesting stuff

This is a few interesting javascript stuff:

1)  javscript namespace declaration:

var yourNamespace = {

    foo: function() {
    },

    bar: function() {
    }
};

...

yourNamespace.foo();

2) javascript test if function is defined:
    http://www.idealog.us/2007/02/check_if_a_java.html

if(typeof yourFunctionName == 'function') { 
yourFunctionName(); 
} 

0 comments:

Post a Comment