Find more freelance jobs
|
/=
i /= 5
i equals i / 5
%=
i %= 5
i equals i %5
++
i++
i equals i+1
--
i--
i equals i-1
Lifetime of Variables
When you declare a variable within a function, only code within that function can access or change the value of that variable. When the function exits, the variable is destroyed. These variables are called local variables. You can have local variables with the same name in different functions, because each is recognized only by the function in which it is declared. If you declare a variable outside a function, all the functions in your script will recognize it. These variables exists from the time they are declared until the time the script is finished running. The Boolean object The Boolean object is one of JavaScript's built-in objects. It can return two values: 0 for false and any other integer value for true. It is used to return a result of a conditional test. For example if you want some code to be executed if a condition is false/true. Methods Explanation NN IE ECMA toString() Returns a string Boolean value. (true or false) 3.0 3.0 1.0 valueOf() 4.0 J3 1.0 Functions A function contains some code that will be executed by an event or a call to that function. A function is a set of statements. You can reuse functions within the same script, or in other documents. You define functions at the beginning of a file (in the head section), and call them later in the document. It is now time to take a lesson about the alert-box: This is JavaScript's method to alert the user. alert("here goes the message") How to define a function To create a function you define its name, any values ("arguments"), and some statements: function myfunction(argument1,argument2,etc) { some statements } A function with no arguments must include the brackets: function myfunction() { |