Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions