JSFiddle - React, Tailwind, and code Playground

by anton_F

JavaScript

* @param {Object} bucket
 * @param {Object} products
 *
 * @returns {number}
 */
function calculateCost(bucket, products) {
  let result = 0;

  for(let i = 0; i < bucket.length; i++) {
    result += bucket[i] * products[i]
  }return result
}