Decimal Numbers
So far in the tour, we have defined age as an integer. However, integer does not allow decimal numbers. If you want to allow decimal numbers, you can use the number type.
Consider a new property, performanceRating.
1{ 2 "name":"John Doe", 3 "age": 25, 4 "performanceRating": 4.5 5}
Now, Try to modify the performanceRating property on the side editor to accept decimal numbers with minimum value as 0 and maximum value as 5.
Also modify the age property to accept only integer values.
(There is no need to set the minimum and maximum values for the age property.)
Loading...
Output
Please click the button or use
Shift+Enter
to view the output