Tuesday 24 September 2013

Javascript anonymous functions

Anonymous functions are functions that are dynamically declared at runtime. They’re called anonymous functions because they aren’t given a name in the same way as normal functions.
Anonymous functions are declared using the function operator instead of the function declaration. You can use the function operator to create a new function wherever it’s valid to put an expression. For example you could declare a new function as a parameter to a function call or to assign a property of another object.
Here’s a typical example of a named function:
1.  function flyToTheMoon()
2.  {
3.    alert("Zoom! Zoom! Zoom!");
4.  }
5.  flyToTheMoon();
Here’s the same example created as an anonymous function:
1.  var flyToTheMoon = function()
2.  {
3.    alert("Zoom! Zoom! Zoom!");
4.  }
5.  flyToTheMoon();

For more :  http://helephant.com/2008/08/23/javascript-anonymous-functions/

JSON: What It Is, How It Works, & How to Use It

The ability to load and manipulate JSON feeds from other sites via AJAX. Many sites are sharing data using JSON in addition to RSS feeds nowadays, and with good reason: JSON feeds can be loaded asynchronously much more easily than XML/RSS. This article will cover the following:
  • What is JSON?
  • Why does JSON matter?
  • How do we use JSON in a project?
We’ll also use our newfound skills with JSON at the end of this project to build a quick app that loads photos from Flickr without requiring a page refresh.
WHAT IS JSON?
JSON is short for JavaScript Object Notation, and is a way to store information in an organized, easy-to-access manner. In a nutshell, it gives us a human-readable collection of data that we can access in a really logical manner.
Reference : COPTER LABS