call js
function Product(name, price) {
this.name = name;
this.price = price;
if (price < 0)
throw RangeError('Cannot create product "' + name + '" with a negative price');
return this;
}
function Food(name, price) {
Product.call(this, name, price);
this.category = 'food';
}
Food.prototype = new Product();
function Toy(name, price) {
Product.call(this, name, price);
this.category = 'toy';
}
Toy.prototype = new Product();
var cheese = new Food('feta', 5);
var fun = new Toy('robot', 40);
Also in JavaScript:
- regular expression characters
- javascript for each
- clearinterval javascript
- javascript events list with examples
- post method javascript code
- callback function
- camelcase to hyphenated javascript
- random color code javascript
- jquery on window ready
- javascript document.createElement add function
- and operator in javascript
- js percorrer objeto
- how to create react app in vs code
- node get value from map
- (click)="onProductSelect(item.id)"
- javascript repeat each second
- javascript includes method getting 'hi' and 'high' problem
- dynamodb get all items nodejs
- tappify.js
- what is amqp10 policy nodejs
- js draw square to canvas
- hide show jquery
- c# json from file to object
- get only one type from json