JSFiddle - React, Tailwind, and code Playground
by Liaqat Saeed
JavaScript
let products = [1, 10, 2, 11, 5, 3];
let maxValuArray = [];
for(let item of Array.from({length:3},(i)=>{})){
let maxVal = products.splice(products.indexOf(Math.max(...products)),1);
maxValuArray = [...maxValuArray,...maxVal]
}
alert(maxValuArray.reduce((prev,curr)=> prev * curr))