Skip to content

new-member-34: Calculate cost of basket #119

@stevehopkinson

Description

@stevehopkinson

Calculate cost of basket

Write a function, priceOfBasket, that returns the total cost of a basket of items.

Input will be:

  • an object containing keys (items available in the shop) and values (their prices): {banana: 3, orange: 4, pear: 5, apple: 2}
  • an array of strings representing the individual items bought: ['banana', 'orange', 'apple', 'banana', 'orange', 'banana']

Output should be:

  • an integer representing the total cost of the individual items bought: 19

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions