var num = Math.PI; console.log(num.toFixed(2));
Understanding the code
In the above code snippet, `Math.PI` returns the value of PI. It is a static property of the `Math` object, and to call it, you have to use `Math.PI` as depicted in the script.
console.log(Math.PI); // Logs: 3.141592653589793
We then use this value with the `toFixed()` method to fix the number of decimal places to 2. The `toFixed()` method acts on a number and takes an integer value as an argument that denotes the number of digits after the decimal point. It then rounds the number to the specified decimal places and returns it as a string.