Edit It: Use the reduce() method to deduct the array
This code shows how to use the reduce() method to deduct an array in JavaScript.
See it on StackBlitzThis code shows how to use the reduce() method to deduct an array in JavaScript.
See it on StackBlitz