Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Now whether that was five seconds later or five minutes later, we have paused to that point and then we run the next line of code. And that's going to combine the Hello, space, with whatever they typed in using this plus sign to combine these two parts of the message, and then pop-up another dialog box. If I open up this webpage to load it again, there is nothing to actually ensure that somebody types a name here. I could type in a number and click OK and it will just combine that message.
It could have been a number. It could have been a sentence. It could have been nothing at all. If I want to run that code again, I could either close and reopen it or I could click the button in the browser to reload the current page and we'll effectively run the script again. I could even leave that completely blank and click OK. Now here it doesn't matter, but if our program, if our code, was expecting something very specific to work with like a birth date or an amount or an email address, the wrong kind of input could cause it to crash.
Because again programs are all about input and output. There is an old phrase called G-I-G-O, GIGO for Garbage In, Garbage Out, whatever you're asking for, and whatever you get better make sense. Later on we'll see how to do some checking on our input.
Get unlimited access to all courses for just $25/month.Become a member