Happy New Year 2014

What do you check first when you start your day?

Want to create a new poll now?
(Login Required)

What do you check first when you start your day?

Email 23 71.90
Facebook 4 12.50
Twitter 0 0.00
Web News 0 0.00
Favourite Website 0 0.00
TV News 1 3.10
News Paper 2 6.20
Other 2 6.20

Total Responses: 32

Not scientifically valid. Results are updated every 15 minutes.


JQuery Basics and Built in functions

Author: Renuka Email: ********
Last Updated: 8/30/2012 11:58:05 AM Views:
Level: Beginner Downloads: 0


JQuery basics:

jQuery is a framework built using javascript capabilities. So all the functions and other capabilities available in javascript can be used in jQuery. This chapter would explain most basic concepts but frequently used in jQuery.


A string in javascript is an immutable object that contains none, one or many characters.
Following are the valid examples of a Javascript String:

“This is JavaScript String”
‘This is JavaScript String’
‘This is “really” a JavaScript string’
“This is ‘really’ a JavaScript string”


Numbers in JavaScript are double-precision 64-bit format IEEE 754 values. They are immutable, just as strings.
Following are the valid examples of a JavaScript Numbers:



A Boolean in JavaScript can be either true or false. If a number is zero, it defaults to false. If an empty string defaults to false:
Following are the valid examples of a JavaScript Boolean:

true              //true
false             //false
0                  //false
1                  //true
“ ”               //false
“hello”         //true


JavaScript supports Object concept very well. You can create an object using the object literal as follows:

var emp={
name: “zara”,
age: 10

You can write and read properties of an object using the dot notations as follows:

//getting object properties
Emp.name        //zara
Emp.age          //10

//setting object properties
Emp.name=”Daisy”        //Daisy
Emp.age=20                 //20


You can define arrays using the array literal as follows

var x=[];
var y=[1, 2, 3, 4, 5];

An array has a length property that is useful for iteration:

var x=[1,2,3,4,5];
for (var i=0; i< x.length; i++){
//do something with x[i]


A function in javascript can be either named or anonymous. A named function can be defined using function keyword as follows:

function named() {
//do some stuff here

An anonymous function can be defined in similar way as a normal function but it would not have any name.
An anonymous function can be assigned to a variable or passed to a method as shown below:

var handler=function(){
//do some stuff here

jQuery makes use of anonymous functions very frequently as follows:

//do some stuff here


JavaScript variable argument is a kind of array which has length property. Following example explains it very well:

Function func(x){
Console. (typeof x, arguments.length);
func();                         //”undefined”, 0
func(1);                        //”number”, 1
func(“1”,”2”,”3”);        //”string”, 3

The arguments object also has a callee property, which refers to the function you’re inside of. For example:

function func(){
     return arguments.callee;
func(); //func


The scope of a variable is the region of your program in which it is defined. JavaScript variable will have only two scopes.
  • Global Variables:

    A global variable has global scope which means it is defined every where in your javascript code.
  • Local Variables:

    A local variable will be visible only within a function where it is defined. Function parameters are always local to that function.
Within body of function, a local variable takes precedence over a global variable with the same name:

var myVar=”global”;           //Declare a global variable
var myVar “local”;              //Declare a local variable
document.write(myVar);        //local

Builtin functions:

JavaScript comes along with a useful set of built-in functions. These methods can be used to manipulate string numbers and dates.
Following are important javascript functions:
Method Description
charAt() Returns the character at the specified index.
concat() Combines the text of two strings and returns a new string.
forEach() Calls a function for each element in the array.
IndexOf() Returns the index within the calling string object of the first occurrence of the specified value, or -1 if not found.
length() Returns the length of the string.
pop() Removes the last element from an array and returns that element.
push() Adds one or more elements to the end of an array and returns the new length of the array.
reverse() Reverses the order of the elements of an array, the first becomes the last, and the last becomes the first.
sort() Sorts the elements of an array
substr() Returns the characters in a string beginning at the specified location through the specified number of characters.
toLowerCase() Returns the calling string value converted to lower case.
tostring() Returns the string representation of the number's value.
toUpperCase() Returns the calling string value converted to uppercase.

Comments/Suggestions are invited. Happy coding......!

Oops ! No Entries found Oops... No entries found !
Post your comments:

Name :    
Email :      
Subject :  
Message :    
Type the word :    

Contact us

You might also like this!