Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //A prototype similar to the concept of class
- var Person = function(name, age, gender){
- this.name = name;
- this.age = age;
- this.gender = gender;
- this.detailsDisplay = function(){
- console.log(this.name);
- console.log(this.age);
- console.log(this.gender);
- };
- };
- var Career = function(job, experience, salary){
- this.job = job;
- this.experience = experience;
- this.salary = salary;
- this.detailsDisplay = function(){
- console.log(this.job);
- console.log(this.experience);
- console.log(this.salary);
- };
- };
- var john = new Person('John', 90, 'Male');
- john.Career = new Career('DJ', '10', '500');
- john.detailsDisplay();
- john.Career.detailsDisplay();
Add Comment
Please, Sign In to add comment