A price cell with three shapes

Distinguish a missing price from a price of zero.

your task

Keep the parameter type. Format numbers and numeric text with two decimal places, including zero. Return “no price” for null or empty text. The type check and all cases must pass.

The starter labels numeric zero “no price”. It also stops when a price arrives as text. The room table uses null or an empty string for a missing price.

Starter code
or press Ctrl EnterNot run yet

type check

Not run yetprice.ts

Expected result: no type errors.

cases

Not run yetNumeric and text prices

Expected output

112.50
28.00
See the input and the code for this case
console.log(priceLabel(12.5));
console.log(priceLabel("8"));
Not run yetNull and empty text

Expected output

1no price
2no price
See the input and the code for this case
console.log(priceLabel(null));
console.log(priceLabel(""));
Not run yetNumeric and text zero

Expected output

10.00
20.00
See the input and the code for this case
console.log(priceLabel(0));
console.log(priceLabel("0"));