It is mainly used in mathematics problem.
> "Audi" > "A8"
Here as we can see that property of the object car, is going to store the string as “Audi” and it can be accessed with car.name.
sayModel is a method i.e, a function of the object and it can be accessed with car.sayModel().
It can be noticed that sayModel is just a function which uses ().
- Here nothing is passed as a parameter because, Math.PI is not a function but it is a property.
- It simply return the value of PI i.e, Π
Here simply value of PI i.e, Π is shown as ouput.
Value of PI i.e, Π can be printed as in the form of function as shown below.
- Here we consider Math.PI as a function but in actual it is a property that is why error as output is being shown.
// Here we consider Math.PI as a function but in actual it
// is a property that is why error as output is being shown.
Error: Math.PI is not a function
Errors and Exceptions:
Whenever we need to find the value of anything related to PI that time we take the help of this property.In mathemaatics it needed a lot.
Here we are going to find the value of area of a circle with given value of its radius.
Here unit is square unit. > 78.53981633974483