Check every price

A price check must report when there are no prices to check.

your task

For each price of 0 or less, print “bad price: ” followed by the price. Finish with the count, as in “checked 3 prices”. For an empty list, print only “fail: no prices to check”.

The price report ends with just “checked”, even when the list is empty. A reader cannot tell how many prices the test checked.

Starter code
or press Ctrl EnterNot run yet

cases

Not run yetOne price is zero

Expected output

1bad price: 0
2checked 3 prices
See the input and the code for this case
const prices = [40, 0, 25];
Not run yetAll prices are positive

Expected output

1checked 2 prices
See the input and the code for this case
const prices = [40, 25];
Not run yetThe price list is empty

Expected output

1fail: no prices to check
See the input and the code for this case
const prices = [];