What is the price of this?

Report a typo

Look at the products object below:

const products = {
    apple: 1.99,
    banana: 0.99,
    orange: 2.49
};

Complete the missing parts in the code below that includes the getProductPrices() function and logs the following message in the console:

apple: $1.99
banana: $0.99
orange: $2.49
Fill in the gaps with the relevant elements
function getProductPrices(products) {
    return Object.(products).(([product, price]) => {
        return `${}: $${}`;
    }).join('\n');
}
const prices = getProductPrices(products);
console.log(prices);

Create a free account to access the full topic