I will make a example code for class by javascript. i want to implement method that return price using arrow function. below the code i wrote, and it works.
class Product{
        constructor(name, weight, price){
            this._name = name;
            this._weight = weight;
            this._price = price;
        }
        //calculate = (weight) => (weight / 100) * _price;
        calculate(weight){
            return (weight / 100) * this._price;
        }
    }
    const product = new Product("fork", 100, 1690);
    alert( product.calculate(200) + "won");
but after modify to
calculate = (weight) => (weight / 100) * _price;
/*
calculate(weight){
    return (weight / 100) * this._price;
}
*/
occur error "Uncaught SyntaxError: Unexpected token =" in chrome.
why that error occur? and how to modify? thanks for watching!!
 
    