Skip to content

Instantly share code, notes, and snippets.

@radum
Created October 26, 2015 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radum/cc9f2bd951e70d5efc24 to your computer and use it in GitHub Desktop.
Save radum/cc9f2bd951e70d5efc24 to your computer and use it in GitHub Desktop.
Javascript Module Formats
define(function () { 'use strict';
// This function gets included
function cube ( x ) {
// rewrite this as `square( x ) * x`
// and see what happens!
return x * x * x;
}
console.log( cube( 5 ) ); // 125
});
'use strict';
// This function gets included
function cube ( x ) {
// rewrite this as `square( x ) * x`
// and see what happens!
return x * x * x;
}
console.log( cube( 5 ) ); // 125
// This function gets included
function cube ( x ) {
// rewrite this as `square( x ) * x`
// and see what happens!
return x * x * x;
}
console.log( cube( 5 ) ); // 125
(function () { 'use strict';
// This function gets included
function cube ( x ) {
// rewrite this as `square( x ) * x`
// and see what happens!
return x * x * x;
}
console.log( cube( 5 ) ); // 125
})();
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
typeof define === 'function' && define.amd ? define(factory) :
factory();
}(this, function () { 'use strict';
// This function gets included
function cube ( x ) {
// rewrite this as `square( x ) * x`
// and see what happens!
return x * x * x;
}
console.log( cube( 5 ) ); // 125
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment