All pastes #1071502 Raw Edit

Mine

public html v1 · immutable
#1071502 ·published 2008-07-14 05:40 UTC
rendered paste body
<script>var drinks = 0;var foods = 0;function drink(beverage){  drinks += 1;  if(drinks <= 10)     if(Math.random() >= 0.5)     {        return this.name + " takes a sip of some " + beverage + ".";     }     else     {       return this.name + " chugs a bucket of " + beverage + ".";     }  else  {    return this.name + " has drank too much to have any " + beverage + ".";  }}function eat(food){  foods += 1;  if(foods <= 10)  {     if(Math.random() >= 0.5)     {        return this.name + " munches on a bit of " + food + ".";     }     else     {       return this.name + " chomps a chunk of " + food + ".";     }  }  else  {    return this.name + " is too full to have any " + food + ".";  }}function human(name){  this.name = name;  this.drink = drink;  this.eat = eat;}function test(){  var bob = new human("Bob");  document.getElementById("msgSpan").innerHTML += "<br>" + bob.drink("Cola");  document.getElementById("msgSpan").innerHTML += "<br>" + bob.eat("Pizza");}</script><button onclick="test()">test()</button><span id="msgSpan"></span>