Very simple Javascript and typescript solution. Do check it out👍
Intuition\nThe maximum product can either come from the three largest numbers or from two smallest negative numbers and the largest positive number.\n\n# Approa
# Intuition\nThe maximum product can either come from the three largest numbers or from two smallest negative numbers and the largest positive number.\n\n# Approach\nTrack the three largest and two smallest numbers while iterating through the array. The result is the maximum product of either the three largest numbers or two smallest with the largest.\n\n# Complexity\n- Time complexity:\nO(n) - Single pass through the array\n\n- Space complexity:\nO(1) - Only constant space is used.\n\n# Code\n```typescript []\nfunction maximumProduct(nums: number[]): number {\n    let largest: number = -Infinity, second: number = -Infinity, third: number = -Infinity;\n    let smallest: number = Infinity, secondSmallest: number = Infinity;\n    \n    for (let i = 0; i < nums.length; i++) {\n        if (nums[i] > largest) {\n            third = second;\n            second = largest;\n            largest = nums[i];\n        } else if (nums[i] > second) {\n            third = second;\n            second = nums[i];\n        } else if (nums[i] > third) {\n            third = nums[i];\n        }\n\n        if (nums[i] < smallest) {\n            secondSmallest = smallest;\n            smallest = nums[i];\n        } else if (nums[i] < secondSmallest) {\n            secondSmallest = nums[i];\n        }\n    }\n\n    return Math.max(largest * second * third, largest * smallest * secondSmallest);\n};\n```\n```javascript []\n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar maximumProduct = function(nums) {\n    let largest = -Infinity, second = -Infinity, third = -Infinity;\n    let smallest = Infinity, secondSmallest = Infinity;\n    \n    for(let i = 0; i < nums.length; i++) {\n        if (nums[i] > largest) {\n            third = second;\n            second = largest;\n            largest = nums[i];\n        } else if (nums[i] > second) {\n            third = second;\n            second = nums[i];\n        } else if (nums[i] > third) {\n            third = nums[i];\n        }\n\n        if (nums[i] < smallest) {\n            secondSmallest = smallest;\n            smallest = nums[i];\n        } else if (nums[i] < secondSmallest) {\n            secondSmallest = nums[i];\n        }\n    }\n\n    return Math.max(largest * second * third, largest * smallest * secondSmallest);\n};\n```\n
['Array', 'Math', 'TypeScript', 'JavaScript']