We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 1: Let and Const
Day 1: Let and Const
Sort by
recency
|
198 Discussions
|
Please Login in order to post a comment
try {
// Attempt to redefine the value of constant variable PI PI = 0; // Attempt to print the value of PI console.log(PI); } catch(error) { console.error("You correctly declared 'PI' as a constant."); } this try causing additional console as 0 and leading to wrong answer what i can do
const PI = Math.PI; const r = parseFloat(readLine());
let area = PI * r * r console.log(area)
let perimeter = 2 * PI * r console.log(perimeter)
const PI = Math.PI
use Math.PI