Tutorials Tutorials
Home
Tutorials
TutorialsShow Love to the Object Literal
A Javascript tip from Chris Heilmann, who reckons the object literal is "pretty close to sliced bread". Replace:
var commonSense=null;
var standardsCompliance="50%";
function init(){
// code
}
function doStuff(){
// code
}
function doMoreStuff(){
// code
}
with the object literal form:
awesome={
commonSense:null,
standardsCompliance:"50%",
init:function(){
// code
},
doStuff:function(){
// code
},
doMoreStuff:function(){
// code
}
}
He's noticed that newer tutorials [...]
Read Next: Mastering Ajax with IBM developerWorks
Related Topics
AjaxWith.com Offers
Sponsored Links
