We're a place where coders share, stay up-to-date and grow their careers.
My javascript solution :
const getEvolutionRateMessage = (before, after) => { evolution = before > 0 ? ((after - before) / before) * 100 : (after - before) * 100; return evolution === 0 ? "No Evolution" : `A ${evolution > 0 ? "Positive" : "Negative"} evolution of ${Math.abs( evolution ).toFixed(2)}%`; }
My javascript solution :