On OS X,
$ node celebrate.js | pbcopy
// pre-compiled | |
function randomElement(array) { | |
var index = Math.random() * array.length | 0; | |
return array[index]; | |
} | |
function printEmoji(emoji, num) { | |
if (num <= 0) | |
return; | |
process.stdout.write(randomElement(emoji)); | |
return printEmoji(emoji, --num); | |
} | |
(function main() { | |
var emoji = ["β€", "π", "β₯", "π", "π", "π", "π", "π", "π", "π", "π", "π", "π", "π",]; | |
var numberOfElements = 140; | |
printEmoji(emoji, numberOfElements); | |
})(); |
/// <reference path="node.d.ts" /> | |
function randomElement(array: Array<string>): string { | |
const index = Math.random() * array.length | 0; | |
return array[index]; | |
} | |
function printEmoji(emoji: Array<string>, num: number) { | |
if (num <= 0) return; | |
process.stdout.write(randomElement(emoji)); | |
return printEmoji(emoji, --num); | |
} | |
(function main() { | |
const emoji: Array<string> = | |
["β€","β₯","π","π","π","π","π","π","π","π","π","π","π",]; | |
let numberOfElements: number = 140; | |
printEmoji(emoji, numberOfElements); | |
})(); |