AJAX Home
TutorialsShow Love to the Object Literal
Category: Tutorials Add Comment 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 Article Sponsored Links
Related Articles
• Speeding Up Object Instantiation Object instantiation is important for Ajax since it increases the loading time of its functions. Developers have to work with objects most of the time since the objects should be able to determine the behavior of the functions as well as its performance.
However, the number of objects in an Ajax a ...
• Detecting Object Problems A very smart practice in coding is to test if the function will have the ability to perform in a particular browser. This is especially true in Ajax-based websites as developers have to face constant browser incompatibilities. Objects could easily be a problem when everything is in place for a parti ...
• Java object serialization for Ajax If you're doing Java™ Web development using Asynchronous JavaScript and
XML (Ajax), then delivering data from the server to the client is
probably your top concern. In this second article in the Ajax for Java developers
series, Philip McCarthy
walks you through five approaches to Java objec ...
• Reusing XMLHttpRequest Object in IE I came across an article posted by Eric (Coauthor of Ajax In Action) which talks about reusing XMLHttpRequest object. I read many blogs and message boards where similar kind of problem was faced by many users. But frankly speaking I never faced this problem before, except in the example given by Eri ...
• Dynamic HTML and XML : The XMLHttpRequest object As deployment of XML data and web services becomes more widespread, you may occasionally find it convenient to connect an HTML presentation directly to XML data for interim updates without reloading the p ...
• Make the XMLHttpRequest Object Work Cross-Browser Microsoft invented the XMLHttpRequest object for Internet Explorer, but it's now supported in Safari, Opera and Mozilla browsers, although the underlying implementation is different. Still, the interfaces are similar enough that with a little effort you can use the XMLHttpRequest object to exch ...