JavaScript

this,var.

JavaScript

Written by VR Sunday, 20 March 2011 13:41

this: A keyword that refers to the current object.For example in a form element object event handler you can pass the object as a parameter to the function:

Inside a custom object constructor the keyword refers to the object itself,allowing you to assign values to its properties.

function CD(label,num,artist) {

this.label = label

this.num = num

this.artist = artist

}

Inside a function the this keyword refers to the function object

Example:

VAR: A keyword that defines the creation of a new variable.Although the keyword is optional for global variables,it is good from to use this keyword for each new variable.Using the var keyword inside a function makes the variable local to statements inside the function.

Example:var a,b,c

var myName = "Susan"

 

Statements.

JavaScript

Written by VR Sunday, 20 March 2011 13:35

Comment statements that let you enter non executing text in a script.Any text following the // symbol anywhere in a statement line is ignored by the language interpreter.The next line of script unless it begins with another // symbol is interpreted by the browser.For longer comment blocks you can begin a block with the /* symbol.Comment blocks may run any number of lines.The block is closed with the */symbol after which the interpreter engages subsequent statements.

Eaxample: //convert temp from C to F

/*

many lines of comments

*/

unescape( ),unwatch( ),watch( ).

JavaScript

Written by VR Sunday, 20 March 2011 13:26

unescape( ).: Returns a decoded version of the URL encoded string passed as a parameter to the function.URL encoding converts non alphanumeric characters to hexadecimal values.

Returned Value:String.

unwatch(),watch( ).When a statement invokes the watch( ) function for an object the parameters include the property whose value is to be watches and the reference to the function to be invoked when ever the value of the property is changed by an assignment statement.To sum off the watch operation invoke the unwatch( ) function for the particular property engaged earlier.

Returned value: Nothing.

 

toString( ).

JavaScript

Written by VR Sunday, 20 March 2011 13:22

Returns a string version of a number in the number base specified by the radix parameter.This variant of the toString( ) function lets you perform number base conversions.For example,the following sequence converts a base-10 number to a base-16 version as a string:

var a = 32

var b = a.toString(16)

After these statements execute,the value of b is "20".

Returned Value: A string.

parseFloat( ).

JavaScript

Written by VR Sunday, 20 March 2011 13:15

Returns a number value of the numerals in the string passed as a parameter.The string value must at least begin with a numeral or the result is NaN.If the string starts with numbers but changes to letters along the way,only the leading numbers are converted to the integers.Therefore,you can use the expression:

parseFloat(navigator.appVersion) to extract the complete version number that leads the otherwise long string that is returned from that property.If the converted value does not have any nonzero values to the right of the decimal the returned value is an integer.Floating point values are returned only when the number calls for it.

Returned Value:Number.

 

Page 1 of 6

«StartPrev123456NextEnd»

Login Form (Can use your Gmail Acct)

Latest Comments

Copyright © 2017 Interview Questions, Tutorials, Certification Questions. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.