Skip to content
Advertisement

Is their any way to Loop through data of array & create another array from it?

I am trying to create a array from this input:

JavaScript

to output:

JavaScript

Here [y] will number of times the date repeats here from the input.

Advertisement

Answer

Please see the below example

JavaScript

Output

JavaScript

Test here: http://sandbox.onlinephpfunctions.com/code/c6b7be9876828c41235e01b1e7eb6434f65db5f1

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement