Web Dev Notes

Blog about web development by Robert Dawson

Make a baby with JavaScript!

This JavaScript code makes a baby that eats and poops right in your browser's console!

// make a baby constructor
var Baby = function(name){
    this.name = name;
// let the baby eat
Baby.prototype.eat = function(){
    console.log("Nom, nom, nom...");
// let the baby poop
Baby.prototype.poop = function(){
    console.log("Wah, wah, wah...");
// make a baby
var myBaby = new Baby();
// name the baby
myBaby.name = "Kal-El";
// say the baby's name
// feed the baby
// watch the baby poop

// TODO: Write birdsAndBees()
// TODO: Write payForCollege()
// TODO: Write getAJob()