Take a look at the snippet below. It pertains to XMLHttpRequest objects.
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == XHR_SUCCESS && httpRequest.state == HTTP_SUCCESS)
return httpRequest.responseXML.asObject();
}
You’ll notice that there’s a prototype hung off of responseXML: asObject(). If I wanted to defined that prototype that’s supported cross-browser, how would I? Can you fill in the blank for me?
______.prototype.asObject = function() {
// JSON.fromDOMtoObject() converts an
// XML document into a JSON string,
// then eval()s the string and returns
// the Object that eval() created. This
// function is already defined in my
// framework.
return JSON.fromDOMtoObject(this);
}