JavaScript Objects Part 1: Objects and Calculations

Objectives

  • An input box for the user to enter a number with 4 decimals
  • A textarea where you will write the output/result
  • Verify the number has at least 4 decimal points
  • If user types invalid number, display error message
  • If user types valid number, you will use Math.round, Math,sqrt, Math.floor, toFixed() etc for each requested calculation

Results




Part 1


Create a script that verifies user entry is a four decimal number and present calculations using Math.round, Math.sort, Math.floor, toFixed(), and parseFloat()

View Part 1

Part 2


Write a sccript that allows the user to enter long text into a textarea, then enter a single character in a separate input. The script will count how many times the single character is in the long text.

View Part 2

Part 3


Create a script that validates user input for a telephone number in (999) 999-9999 format.

View Part 3