Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

oops in js

// Defining class in a Traditional Way.
function Vehicle(name,maker,engine){
    this.name = name,
    this.maker = maker,
    this.engine = engine
};
 
Vehicle.prototype.getDetails = function(){
    console.log('The name of the bike is '+ this.name);
}
 
let bike1 = new Vehicle('Hayabusa','Suzuki','1340cc');
let bike2 = new Vehicle('Ninja','Kawasaki','998cc');
 
console.log(bike1.name);
console.log(bike2.maker);
console.log(bike1.getDetails());
Comment

PREVIOUS NEXT
Code Example
Javascript :: nested callbacks javascript 
Javascript :: divisible check javascript 
Javascript :: if array javascript 
Javascript :: How to filter data using javascript 
Javascript :: onchange vue 
Javascript :: js create nested object from array 
Javascript :: regular expression 
Javascript :: discordjs 
Javascript :: dynamodb json to regular json 
Javascript :: javascript weakmap 
Javascript :: angular file upload 
Javascript :: js try without catch 
Javascript :: queryinterface select 
Javascript :: react scroll animation 
Javascript :: javascript strin literal 
Javascript :: jquerey dropdown button 
Javascript :: javascript access map elements 
Javascript :: this keyword in javscript 
Javascript :: js embedded function 
Javascript :: pre selected data-grid material-ui 
Javascript :: how to add variables to an array in javascript 
Javascript :: why we use react js 
Javascript :: dynamic routing 
Javascript :: javascript date timezone 
Javascript :: rxjs of 
Javascript :: javascript inheritance 
Javascript :: use node modules in next.js 
Javascript :: + javascript 
Javascript :: jaascript loop 
Javascript :: nodejs cluster 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =