Requesting input

Keyboard Shortcuts

The JavaScript language is primarily used to create websites, so it does not need to communicate with the computer's hard drive, printer, or other hardware. Still, like all computer programs, it requires an input to create an output. Learning how to write JavaScript properly makes it possible for the program to accept inputs from users and give them the intended results. Learn how to request input from website users with this online tutorial from Lynda.com.

Computer programs are all about input and output.…From the earliest programs where you might feed a stack of punch cards in one…end to get a printout on the other end, where these days the input might be…click the button, or move the mouse or even wave your hand in the air, and the…output could be change what's displayed on the screen, or cause the game…controller to vibrate.…The different languages favor different kinds of input and output.…JavaScript is all about the webpage.…It doesn't read files on your hard drive.…

It doesn't talk directly to your printer.…It's interested primarily in what's on the webpage and what you might interact…with on the webpage.…Now we've already got some output going on.…We've got an alert box.…That might not be impressive output, but it is output.…It's our computer program causing something to happen on the screen, so let's…get something into our program.…So I have a folder with two files in it.…It's the same setup as last time. In fact, it's an identical container.html file…

Resume Transcript Auto-Scroll

Author

Released

9/22/2011

This course provides the core knowledge to begin programming in any language. Simon Allardice uses JavaScript to explore the core syntax of a programming language, and shows how to write and execute your first application and understand what's going on under the hood. The course covers creating small programs to explore conditions, loops, variables, and expressions; working with different kinds of data and seeing how they affect memory; writing modular code; and how to debug, all using different approaches to constructing software applications.

Finally, the course compares how code is written in several different languages, the libraries and frameworks that have grown around them, and the reasons to choose each one.

Topics include:

Writing source code

Understanding compiled and interpreted languages

Requesting input

Working with numbers, characters, strings, and operators

Writing conditional code

Making the code modular

Writing loops

Finding patterns in strings

Working with arrays and collections

Adopting a programming style

Reading and writing to various locations

Debugging

Managing memory usage

Learning about other languages

Skill Level Beginner

4h 47m

Duration

13,765,925

Views

Show MoreShow Less

Q: Using TextEdit with Mac OS 10.9 Mavericks?

A: If you're using the built-in TextEdit program in Mavericks to write your first examples and your code doesn't seem to be working, here's one reason why: by default, "smart quotes" are now turned on in TextEdit Preferences.

This is where TextEdit will automatically change pairs of double quotes to "smart quotes" - where the opening and closing quote are different, like a 66 and 99.

While this is fine for human eyes, programming languages don't want this - when writing code, they need to be the plain, generic straight-up-and-down quotes.

So make sure that in TextEdit > Preferences, that "Smart quotes" are unchecked.

Important! Whenever you make a change to TextEdit preferences, make sure to then completely quit out of the program (Command-Q or using TextEdit > Quit TextEdit) and then re-open it, as changes won't take effect on documents you already have open.

However, we're not finished - just because you've changed the preferences, it does **not** change any *existing* smart quotes back to "regular" quotes - it just doesn't add new ones - so make sure to go through your files for any time you wrote quotes and TextEdit may have changed them to smart quotes - look in both the JavaScript, and your HTML too, and compare to the downloadable exercise files if necessary.

If that sounds like a bit of a chore, I recommend just downloading a code editor like Sublime Text (www.sublimetext.com) or TextMate (www.macromates.com) and using that instead of TextEdit - it's only a matter of time before you'd move away from TextEdit anyway - we only used it in the course because it was built-in and a quick way to get started, but it's now become more of a inconvenience than it was before.