JavaScript Clean One Pass Solution
javascript\nvar maxProfit = function(prices) {\n    let maxProf = 0, curr = prices[0];\n    \n    for(let x of prices) {\n        if(curr < x) maxProf = Math.ma
```javascript\nvar maxProfit = function(prices) {\n    let maxProf = 0, curr = prices[0];\n    \n    for(let x of prices) {\n        if(curr < x) maxProf = Math.max(maxProf, x - curr);\n        else curr = x;\n    }\n    return maxProf;\n};\n```
['JavaScript']