Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Sukuriame zmogaus klase
- var Person = function(name, surname) {
- this.name = name;
- this.surname = surname;
- this.isGangsta = true;
- };
- Person.prototype.kill = function(victim) {
- if (this.canTalk) {
- console.log('Hi, I am ' + this.name);
- console.log('Die, ' + victim.name);
- }
- };
- var tom = new Person("Tom", "Smith");
- var john = new Person("John", "Bravo");
- if(tom.isGangsta) {
- tom.kill(john);
- }
- tom.name;
- tom.kill();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement