In this HackerRank Day 1: Let and Const 10 days of javascript problem solution Declare a constant variable, PI, and assign it the value Math.PI. You will not pass this challenge unless the variable is declared as a constant and named PI (uppercase).
Read a number, r, denoting the radius of a circle from stdin.
Use PI and r to calculate the area and perimeter of a circle having radius r.
Print area as the first line of output and print perimeter as the second line of output.

HackerRank Day 1: Let and Const problem solution

Problem solution in JavaScript programming.

function main() {
    // Write your code here. Read input using 'readLine()' and print output using 'console.log()'.
    const PI = Math.PI;
    let r = readLine();
     function area(PI,r) {
        area = PI * (r *r);
        console.log(area);
       
    } 
    
    function perimeter(PI,r) {
        perimeter = 2 *PI * r ;
        console.log(perimeter);
    }
   
    // Print the area of the circle:
     area(PI,r);
    
    
    // Print the perimeter of the circle:
    
    perimeter(PI,r);