Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Animal(name) {
- this.name = name;
- this.canWalk = true;
- }
- Animal.prototype.sit = function() {
- this.canWalk = false;
- alert(this.name + ' sits down.');
- };
- var animal = new Animal('Pet');
- console.log(animal.canWalk);
- animal.sit();
- console.log(animal.canWalk);
Advertisement
Add Comment
Please, Sign In to add comment