question archive JavaScript foundations: Object shorthand & spread Instructions To complete this Practice problem, you will update the existing functions in src/solution
Subject:Computer SciencePrice:19.89 Bought3
To complete this Practice problem, you will update the existing functions in src/solution.js
to use new syntax you have learned. Use object shorthand and the spread operator whenever possible.
/*
Modify each function below to continue working with the suggested syntax.
When a function's parameters reference `product`, it is referring to an object. Each object has the following shape:
{
name: "Washed Black Denim Overalls",
priceInCents: 12000,
availableSizes: [ 28, 30, 32, 36 ]
}
*/
// `salesTax` is a decimal number, like 0.065
function createSalesProduct(product, salesTax) {
return {
name: product.name,
availableSizes: product.availableSizes,
salesTax: 0.065,
priceInCents: product.priceInCents * (1 + salesTax),
};
}
function joinSizes(productA, productB) {
const result = ...productA.availableSizes, ...productB.availableSizes;
}
return result;
}
Purchased 3 times