-
20
pages
-
English
-
Documents
Description
XPReview• Declare a variable• Give example of a Numeric, String, Boolean Variable– Assign a value to it• What does this do: x = x+1• What does this do: x++• What does this code do:Tutorial 10 New Perspectives on HTML and XHTML, 1ComprehensiveXPCreating JavaScript Functions• A function is a series of commands that perform an action or calculates a value.• A function name identifies a function.• Parameters are values used by the function.function functionName (parameters){JavaScript commands}• Convention: place functions in the section of the HTML file or externallyTutorial 10 New Perspectives on HTML and XHTML, 2ComprehensiveXPFunction examplefunction rectArea (width, length){var area = width * length;return area;}var w = 2;var l = 3;var a = rectArea (w, l);Tutorial 10 New Perspectives on HTML and XHTML, 3ComprehensiveXPWorking with Conditional Statements• Conditional statements are commands that run only when specific conditions are met.• Conditional statements require a Boolean expression.• Q: What is a Boolean expression?• you need one of the following operators to create a Boolean expression:– Comparison operators (==, !=, >, <, >=, <=)– Logical operators (&& = AND, || = OR, | = NOT)– Conditional operators – (condition) ? value1:value2Tutorial 10 New Perspectives on ...
-
Publié par
-
Langue
English