0

Script Cookbook Template

Context

{{Give some context about what the code snippet does, where it's used, why it's used.}}

Usage

{{Give some code examples, just a couple lines, on how to use the code snippet}}

Code

{{The actual code goes here. Make sure to format in the "code" font in the font editor, in the P icon in the toolbar}}

 

Example Post

Context

Everyone gets headaches. This script magically prevents headaches and gives you free cookies. Unless it is Friday, then it gives you doughnuts. 

Usage

var treat = AntiHeadaches.getTastyTreat( new Date() );
console.log( "I'm chowin' down on my " + treat + " today!" );

Code

var AntiHeadaches = {};
(function() {
AntiHeadaches.getTastyTreat = function( date ) {
if( date.getDay() == 5 ) {
return 'Doughnut';
}
else
return 'Cookie';
}
})();

 

0 comments

Please sign in to leave a comment.