Easy solution for js
Approach\n Describe your approach to solving the problem. \n- First we have to sort it out by descending.\n- We have two case to get max number with three numbe
# Approach\n<!-- Describe your approach to solving the problem. -->\n- First we have to sort it out by descending.\n- We have two case to get max number with three numbers.\n- we have two cases -\n### If array contains only postive/negative numbers \n- take first 3 numbers .\n- for example if we sort this [4,2,15,6] descending we wil get [15,6,4,2]. \n- so take the first three indices values 15*6*4 to get max product\n### If array contains both postive & negative numbers \n- we take first number and last two numbers.\n- for example if we sort this [-100,-98,-1,2,3,4] desc we will get [4,3,2,1,-1,-98,-100] \n-  if we take 4 , -100 , -98 and product it then we will get max product.\n\nAt last we compare both approach and check which approach value is greater , then return that value\n\n# Code\n```\n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar maximumProduct = function(nums) {\n    nums.sort((a,b)=> b-a);\n    let l = nums.length;\n    let value1 = nums[0] * nums[1] * nums[2];\n    let value2 = nums[0] * nums[l-1] * nums[l-2];\n    return value1 > value2 ? value1 : value2;\n};\n````please upvote me if this code helped you````
['JavaScript']