JavaScript solution beat 100%
\n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar maximumProduct = function(nums) {\n    let max1 = max2 = max3 = Number.NEGATIVE_INFINITY;\n    l
```\n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar maximumProduct = function(nums) {\n    let max1 = max2 = max3 = Number.NEGATIVE_INFINITY;\n    let min1 = min2 = Number.POSITIVE_INFINITY;\n    for (var i = 0; i < nums.length; i++) {\n        var n = nums[i];\n        if(n >= max1) {\n            max3 = max2;\n            max2 = max1;\n            max1 = n;\n        } else if (n >= max2) {\n            max3 = max2;\n            max2 = n;\n        } else if (n >= max3) {\n            max3 = n;\n        }\n        if(n <= min1) {\n            min2 = min1;\n            min1 = n;\n        } else if (n <= min2) {\n            min2 = n;\n        }\n    };\n    const product1 = max1 * max2 * max3;\n    const product2 = max1 * min2 * min1;\n    return product1 > product2 ? product1 : product2;\n}\n```
[]