13_1.3.4 WebTech – JavaScript 5

An electricity company is looking at ways of getting meter readings from its customers.

It releases an application for smartphones which allows users to submit their meter reading (a 6 digit number).

JavaScript is used to check that a reasonable value is being entered before a meter reading is sent to a server.

When the user enters a meter reading number, the function validateReading is called.

If the number entered is a valid number between 1 and 999999 inclusive, it returns true otherwise it returns false.

You will need to use the JavaScript function isNaN() standing for “is not a number”. This returns true if the value it is given is not a number and false if it is.

isNaN(computer4) returns true
isNaN(203) returns false

Complete the function

function validateReading(reading)