JSFiddle - React, Tailwind, and code Playground
JavaScript
"use strict";
function Hamburger(size, stuffing) {
var sizeInspection = this.getSizesAllowed().indexOf(size);
var stuffingInspection = this.getStuffingsAllowed().indexOf(stuffing);
if (sizeInspection === -1 || stuffingInspection === -1) {
throw new Error('Введены неверные данные');
return;
}
this.size = size;
this.stuffing = stuffing;
}
Hamburger.prototype.SIZE_SMALL = 'small';
Hamburger.prototype.SIZE_BIG = 'big';
Hamburger.prototype.STUFFING_CHEESE = 'cheese';
Hamburger.prototype.STUFFING_SALAD = 'salad';
Hamburger.prototype.STUFFING_POTATOE = 'potatoe';
Hamburger.prototype.SEASONING_MAYO = 'mayonnaise';
Hamburger.prototype.SEASONING_SPICE = 'spice';
Object.defineProperty(Hamburger.prototype, "getCalAndPriceTable",{
value: function() { return [{
thing: Hamburger.prototype.SIZE_SMALL,
cals: 20,
price: 50,
tag: "size"
},
{
thing: Hamburger.prototype.SIZE_BIG,
cals: 40,
price: 100,
tag: "size"
},
{
thing: Hamburger.prototype.STUFFING_CHEESE,
cals: 20,
price: 10,
tag: "stuffing"
},
{
thing: Hamburger.prototype.STUFFING_SALAD,
cals: 5,
price: 20,
tag: "stuffing"
},
{
...