Generation

generate functionMon, 14 Nov 2022

calculate average from array of feedback objects with rating using reduce

function getAverageRating(feedback) { return feedback.reduce((acc, { rating }) => acc + rating, 0) / feedback.length }

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant