Your task is to create a function that simulates a vending machine.
Given an amount of money (in cents ¢ to make it simpler) and a productNumber, the vending machine should output the correct product name and give back the correct amount of change.
The coins used for the change are the following: [500, 200, 100, 50, 20, 10]
The return value is an object with 2 properties:
product: the product name that the user selected.change: an array of coins (can be empty, must be sorted in descending order).vendingMachine(products, 200, 7) ➞ { product: "Crackers", change: [ 50, 20, 10 ] }
vendingMachine(products, 500, 0) ➞ "Enter a valid product number"
vendingMachine(products, 90, 1) ➞ "Not enough money for this product"
productNumber is invalid (out of range) you should return the string: "Enter a valid product number".money is not enough to buy a certain product you should return the string: "Not enough money for this product".change.