Created
October 26, 2015 09:07
-
-
Save radum/cc9f2bd951e70d5efc24 to your computer and use it in GitHub Desktop.
Javascript Module Formats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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