This problem is going to be different. It’s going to use a bare-bones HTML file (i.e. the bare minimum HTML document) with this line inside the body tag:
That’s it for your HTML file, but you will need a second file named “index.js” for your JavaScript. All of your original code will go inside of index.js. I wrote less than 20 lines of code for my solution.
This problem will test your ability to perform input validation. Using a prompt statement, ask the user for a number. Each possible output will use an alert.
• If the user does not enter a number, respond with an error using alert: “Error: You need to enter a number.”
• If the number is a floating-point number (i.e. if you mod the number with 1, the result will be greater than 0), then report, “This is a floating-point number.”
• If the number is even, report that it is even.
• If the number is odd, report that it is odd.
Any given value will fit into one of the four categories: an error, a floating-point value, and even, or an odd. Here are examples of each.
• 1: Odd
• 4: Even
• 5.5: Float
• Fido: This is an error.