flip a coin javascript

JavaScript
function coinFlip() {
    return Math.floor(Math.random() * 2);
}function coinFlip() {
    return (Math.floor(Math.random() * 2) == 0) ? 'heads' : 'tails';
}
Source

Also in JavaScript: