Test case details

Preparation Code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script> <script src="http://digg.googlecode.com/files/Class-0.0.2.js"> </script> <script src="https://ajax.googleapis.com/ajax/libs/prototype/1/prototype.js"></script>
var result = '';

Test cases

Test #1

var Animal = Class.create({ init: function(name, sound) { this.name = name; this.sound = sound; }, speak: function() { result = (this.name + " says: " + this.sound + "!"); } }); var cat = new Animal('Kitty', 'Meow'); cat.speak();

Test #2

var Animal = Class.create({ initialize: function(name, sound) { this.name = name; this.sound = sound; }, speak: function() { result = (this.name + " says: " + this.sound + "!"); } }); var cat = new Animal('Kitty', 'Meow'); cat.speak();

Test #3

function Animal(name, sound) { this.name = name; this.sound = sound; } Animal.prototype.speak = function() { result = (this.name + " says: " + this.sound + "!"); } var cat = new Animal('Kitty', 'Meow'); cat.speak();