Can someone assist me?
I have a value of 4.8 (it represents a rating of 4.8/5).
Now I want to convert it into an array with the following structure:
[1, 1, 1, 1, 0.8]
What I mean is that the value should be split into 5 elements, with each element not exceeding 1.
Here are some more examples:
2.8 should be [1, 1, 0.8, 0, 0]
0.5 should be [0.5, 0, 0, 0, 0]
5 should be [1, 1, 1, 1, 1]
3 should be [1, 1, 1, 0, 0]
and so on...
let number = 4.8;