114k views
5 votes
Many APIs that give you information gathered by the hardware return optionals. For example, an API for working with a heart rate monitor may give you nil if the heart rate monitor is adjusted poorly and cannot properly read the user's heart rate.

Declare a variable heartRate of type Int and set it to nil. Print the value.

User Jcoglan
by
5.8k points

1 Answer

2 votes

Answer:

Using JavaScript;

var heartRate;

heartRate = parseint(nil);

Print(heartRate)

Step-by-step explanation:

JavaScript is a multi-purpose programming language. It is used as a scripting language in web development, implementing object oriented programming to make web pages interactive.

It is used to program interfaces for devices like heartRate detector in hospital. When it read the heartbeat, the output is displayed on the screen.

The nil value assigned to the heartRate variable gives an output of nil, since it can not be converted to integer.

User Matzone
by
5.6k points