var total var purchase_price = 100 var sales_tax = purchase_price * .06 total = purchase_price + sales_taxHowever, it is equally valid to not declare any of the variables, in which case you would write:
purchase_price = 100 sales_tax = purchase_price *.06 total = purchase_price + sales_taxNotice that statements do not have to end with a semi-colon. The newline is interpreted as terminating the statement. If you want to put multiple statements on the same line, then they should be separated with a semi-colon.
booleanExpression ? trueExpression : falseExpressionThe booleanExpression should evaluate to either true or false and either the trueExpression or falseExpression will be evaluated and its value returned as the result of the operator.
The following script will pop up an alert box with your browser's name and version number. You can view the html page source to see what the script looks like.
switch (expression) { case label1, label2, ... labeln: statements; break; case ... case ... default: statements to execute if none of the cases match }There are a few enhancements to C's switch statement in that labels can be one of:
|
|