Buy and Sell a Stock for maximum profit (given a day and a price)
Readability


The way you've named your variables makes the code more difficult to read for example peak just doesn't make sense to me. Another consideration would be to rename buy_day to cheapest_day
Don't overcomplicate things: I found the return statement at the end of your forEach confusing


General syntax improvement that would make the code easier to read:


Use camelCase over snake_case
Use dot notation when accessing an objects properties where possible 


Remove unnecessary/unused code


You have an if/elseif that does the same thing this can be simplified using an or statement if (this || that)
peak.sell and peak.sell_day are never used, same for all in your prices.forEach


Misc

There may be some reasoning you had which I'm missing but I did't see the point in accepting the second argument peak.

Rewrite



const perfectPrice = (prices) =&gt; {
    const week = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
    
    let profit = 0;
    let profitable;
    
    const cheapest = {
        day: null,
        price: null,
    };

    prices.forEach((price, day) =&gt; {
        if (day === 0 || price &lt; cheapest.price) {
            cheapest.price = price;
            cheapest.day = day;
        }
        
        const potential = price - cheapest.price;

        if (!(potential &gt; profit)) {
            return;
        }
          
        profit = potential;
        
        profitable = {
            buy: week[cheapest.day],
            buyAt: cheapest.price,
            sell: week[day],
            sellAt: price,
            profit,
        };
    });

    return profitable || 'not profitable to sell';
};


console.log("(test 1):", perfectPrice([7, 1, 5, 3, 6, 4]))
console.log("(test 2):", perfectPrice([7, 6, 4, 3, 1]))
console.log("(test 3):", perfectPrice([7, 1, 5, 3, 6, 4]))
console.log("(test 4):", perfectPrice([1, 2]))
console.log("(test 5):", perfectPrice([7, 1, 5, 3, 6, 4]))
console.log("(test 6):", perfectPrice([2, 9, 5, 3, 1, 4]))