ReferenceError: π is not defined


#1


function Circle (radius) {
    this.radius = radius;
    this.area = function () {
        return Math.PI * this.radius * this.radius;
        
    };
    // define a perimeter method here
    this.perimeter = function(){
      return 2 * π  * this.radius;  
    };
};


#2

would work if we had defined the symbol in terms of JS

var π = Math.PI

#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.