Intermediate JavaScript

From Wikiversity

Jump to: navigation, search
Crystal Clear app kaddressbook.png
Please help develop this page

This page was created, but so far, little content has been added. Everyone is invited to help expand and create educational content for Wikiversity. If you need help learning how to add content, see the editing tutorial and the MediaWiki syntax reference.

To help you get started with content, we have automatically added references below to other Wikimedia Foundation projects. This will help you find materials such as information, media and quotations on which to base the development of "Intermediate JavaScript" as an educational resource. However, please do not simply copy-and-paste large chunks from other projects. You can also use the links in the blue box to help you classify this page by subject, educational level and resource type.

Wikipedia-logo.png Run a search on Intermediate JavaScript at Wikipedia.
Commons-logo.svg Search Wikimedia Commons for images, sounds and other media related to: Intermediate JavaScript
Wikimedia-logo.svg Search for Intermediate JavaScript on the following projects:
Smiley green alien whatface.svg Lost on Wikiversity? Please help by choosing project boxes to classify this resource by:

[edit] If-then Statements

If then statements are used to tell the browser if this happens, then do this. An if then statement is structured like this:

 if (the condition)
{
code to run
}

For example you could make it so the browser prompts for the user to type in a their age, and if it is below 21 it would pop up an alert saying "no beer for you!". The code would be this:

 
var age = prompt("how old are you?","");
if (age < "21")
{
alert("no beer for you!")
}