Lecture Slides: Checking Whether User Input Is A Number

Checking If User Input Is Numeric
Detecting numeric input
Finish Prior Lecture
 Y'all work on one of the problems listed
Checking if a value is a number
 Examples of data types:
 Integer - whole numbers only, but positive, negative, and zero are
 Floating-point / real - any number (whole or with a decimal point),
positive, negative, zero
 Strings – text ("a string of individual characters")
 Boolean – true or false
 JS will try to convert from one to another in order to help you
 FILE: loose_typing.html
 Note: multiplying by two is great
 Adding 4 isn't great
 Sometimes we need to tell it what to do
 The isNaN() function will tell us if it's NOT a number
 NaN = Not A Number
 parseFloat() will then convert it to a real, floating-point number with decimals
 Use parseInt() if you want to drop anything after the decimal point
 Then it's safe to do math on it
 FILE: checking_for_numbers.html
 Step 1: Check if it's actually a number using isNaN (error & exit if it isn't)
 Step 2: Convert it to a number using parseFloat/parseInt
 Step 3: Do the math 
 Do exercise #1 for this topic
 Once you've got that done, pick problems from exercise #2 to do