Skip to main content

Home/ Groups/ Learning Library
Sunny Jackson

Amelia Earhart - 0 views

Sunny Jackson

Elizabeth Dole - 0 views

Sunny Jackson

Dorothy Day - 0 views

Sunny Jackson

Willa Cather - 0 views

Sunny Jackson

Nellie Bly - 0 views

Sunny Jackson

Jackie Cochran - 0 views

Sunny Jackson

Rachel Carson - 0 views

Sunny Jackson

Paul Krassner - 0 views

Sunny Jackson

John Keats - 0 views

Sunny Jackson

JavaScript Statements - 0 views

  • JavaScript is Case Sensitive
  • A JavaScript statement is a command to a browser. The purpose of the command is to tell the browser what to do.
  • It is normal to add a semicolon at the end of each executable statement.
  • ...6 more annotations...
  • Using semicolons makes it possible to write multiple statements on one line.
  • JavaScript code (or just JavaScript) is a sequence of JavaScript statements.
  • Each statement is executed by the browser in the sequence they are written.
  • JavaScript statements can be grouped together in blocks. Blocks start with a left curly bracket {, and ends with a right curly bracket }.
  • The purpose of a block is to make the sequence of statements execute together.
  • Normally a block is used to group statements together in a function or in a condition (where a group of statements should be executed if a condition is met).
Sunny Jackson

JavaScript Comments - 0 views

  • Comments can be added to explain the JavaScript, or to make the code more readable. Single line comments start with //.
  • Multi line comments start with /* and end with */.
  • In the following example the comment is used to prevent the execution of a single code line (can be suitable for debugging): Example <script type="text/javascript"> //document.write("<h1>This is a heading</h1>");
  • ...2 more annotations...
  • In the following example the comment is used to prevent the execution of a code block (can be suitable for debugging): Example <script type="text/javascript"> /* document.write("<h1>This is a heading</h1>"); document.write("<p>This is a paragraph.</p>"); document.write("<p>This is another paragraph.</p>"); */
  • In the following example the comment is placed at the end of a code line: Example <script type="text/javascript"> document.write("Hello"); // Write "Hello" document.write(" Dolly!"); // Write " Dolly!"
Sunny Jackson

JavaScript Variables - 0 views

  • Variables are "containers" for storing information.
  • variables can be used to hold values (x=5) or expressions (z=x+y).
  • A variable can have a short name, like x, or a more descriptive name, like carname.
  • ...8 more annotations...
  • Rules for JavaScript variable names: Variable names are case sensitive (y and Y are two different variables) Variable names must begin with a letter or the underscore character
  • Creating variables in JavaScript is most often referred to as "declaring" variables.
  • You can declare JavaScript variables with the var keyword: var x; var carname;
  • they have no values yet
  • you can also assign values to the variables when you declare them: var x=5; var carname="Volvo";
  • When you assign a text value to a variable, use quotes around the value.
  • If you assign values to variables that have not yet been declared, the variables will automatically be declared.
  • These statements: x=5; carname="Volvo"; have the same effect as: var x=5; var carname="Volvo";
Sunny Jackson

JavaScript Operators - 0 views

  • = is used to assign values.
  • + is used to add values.
  • The + operator can also be used to add string variables or text values together.
  • ...3 more annotations...
  • To add two or more string variables together, use the + operator. txt1="What a very"; txt2="nice day"; txt3=txt1+txt2;
  • To add a space between the two strings, insert a space into one of the strings: txt1="What a very "; txt2="nice day"; txt3=txt1+txt2; or insert a space into the expression: txt1="What a very"; txt2="nice day"; txt3=txt1+" "+txt2;
  • If you add a number and a string, the result will be a string!
Sunny Jackson

JavaScript Comparison and Logical Operators - 0 views

  • Comparison operators can be used in conditional statements to compare values and take action depending on the result: if (age<18) document.write("Too young");
  • JavaScript also contains a conditional operator that assigns a value to a variable based on some condition. Syntax variablename=(condition)?value1:value2 
Sunny Jackson

JavaScript If...Else Statements - 0 views

  • Conditional statements are used to perform different actions based on different conditions.
  • if statement - use this statement to execute some code only if a specified condition is true
  • if...else statement - use this statement to execute some code if the condition is true and another code if the condition is false
  • ...8 more annotations...
  • if...else if....else statement - use this statement to select one of many blocks of code to be executed
  • switch statement - use this statement to select one of many blocks of code to be executed
  • Use the if statement to execute some code only if a specified condition is true. Syntax if (condition)   {   code to be executed if condition is true   }
  • Note that if is written in lowercase letters. Using uppercase letters (IF) will generate a JavaScript error!
  • Notice that there is no ..else.. in this syntax. You tell the browser to execute some code only if the specified condition is true.
  • If...else Statement Use the if....else statement to execute some code if a condition is true and another code if the condition is not true.
  • Syntax if (condition)   {   code to be executed if condition is true   } else   {   code to be executed if condition is not true   }
  • If...else if...else Statement Use the if....else if...else statement to select one of several blocks of code to be executed. Syntax if (condition1)   {   code to be executed if condition1 is true   } else if (condition2)   {   code to be executed if condition2 is true   } else   {   code to be executed if condition1 and condition2 are not true   }
« First ‹ Previous 81 - 100 Next › Last »
Showing 20 items per page