Function


// function declarations are hoisted, 
// but function expression are not

funcDecl(); // correct!
funcExpr(); // error! 

function funcDecl (){
  alert ('function declaration'); 
}
var funcExpr = funciton () {
  alert('function expression. '); 
}

$.parseJSON()

// Takes a well-formed JSON string and returns the resulting JavaScript value
var obj = jQuery.parseJSON( '{ "name": "John" }' );
alert( obj.name === "John" );

$.each

$("input").each(function (index, elem) {
  // convert the value to number     
  total += Number($(elem).val()); 
});

.data()

$( "body" ).data( "foo", 52 );
$( "body" ).data( "bar", { myType: "test", count: 40 } );
$( "body" ).data( { baz: [ 1, 2, 3 ] } );
$( "body" ).data( "foo" ); // 52
$( "body" ).data(); // { foo: 52, bar: { myType: "test", count: 40 }, baz: [ 1, 2, 3 ] }

results matching ""

    No results matching ""