Question: Code a function called daysuffix that takes a single parameter. The parameter is checked to ensure it's a number (see isNaN()) and then converted to

Code a function called daysuffix that takes a single parameter. The parameter is checked to ensure it's a number (see isNaN()) and then converted to the nearest integer. A check is made that the integer is in the range l to 31 inclusive. If either of the checks fail return the value null. Finally the integer should be returned with the appropriate day of the month suffix (e.g., "1st", "2nd", "3rd", "27th", etc.). Use only one further return statement (for a total of three). Next, test that your function has the correct behaviour. Use a loop to test all valid integer parameter values (1-31). Also individually test the results returned for non-numeric input and numeric, out-of-range and floating point input. Display the results of your testing
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
