JSFiddle - React, Tailwind, and code Playground

JavaScript

function Hamburger(size, stuffing) {


    if (this.getSizes()[size]===undefined){
        throw new Error("Неправильный формат size " + size);
    }
    if (this.getStuffings()[stuffing]=== undefined) {
        throw new Error("Неправильный формат stuffing " + stuffing);
    }


    this._size = size;
    this._stuffing = stuffing;
    this._toppings = [];
}

Hamburger.SIZE_SMALL = "small";
Hamburger.SMALL_PRICE = 50;
Hamburger.SMALL_CALORIES = 20;
Hamburger.SIZE_BIG = "big";
Hamburger.BIG_PRICE = 100;
Hamburger.BIG_CALORIES = 40;
Hamburger.STUFFING_CHEESE = "cheese";
Hamburger.CHEESE_PRICE = 10;
Hamburger.CHEESE_CALORIES = 20;
Hamburger.STUFFING_SALAD = "salad";
Hamburger.SALAD_PRICE = 20;
Hamburger.SALAD_CALORIES = 5;
Hamburger.STUFFING_POTATOES = "potatoes";
Hamburger.POTATOES_PRICE = 15;
Hamburger.POTATOES_CALORIES = 10;
Hamburger.TOPPING_MAYO = "mayo";
Hamburger.MAYO_PRICE = 20;
Hamburger.MAYO_CALORIES = 5;
Hamburger.TOPPING_SAUCE = "sauce";
Hamburger.SAUCE_PRICE = 15;
Hamburger.SAUCE_CALORIES = 0;

Hamburger.prototype.addTopping = function(topping) {
        if (this.getToppings()[topping]=== undefined) {
            throw new Error("Неправильный формат topping " + topping);
        }
        
        if(this.checkToppingForDuplicates(topping)){
				   throw new Error("Топпинг уже добавлен");
				}
        this._toppings.push(topping);
    };
		
Hamburger.prototype.calculateCalories = function() {
        var calories = 0;
        calories+= this.getSizes()[this._size].calories;
				calories+= this.getStuffings()[this._stuffing].calories;
        for (var i = 0; i < this._toppings.length; i++) {
            if (this._toppings[i] == Hamburger.TOPPING_MAYO) {
               calories+= this.getToppings()[this._toppings[i]].calories;
            }
        }
        return calories;
    };
Hamburger.prototype.calculatePrice = function() {
        var price = 0;
       price+= this.getSizes()[this._size].price;
			...