JSFiddle - React, Tailwind, and code Playground
by Newman5
JavaScript
//Making a Request Quiz - Udacity CS255
parseJSON = function (weaponJSON) {
parsedJSON = JSON.parse(weaponJSON);
return parsedJSON['frames']['chaingun_impact.png']['spriteSourceSize']['x'];
};
// Create a new XMLHttpRequest object
var weaponXHR = new XMLHttpRequest();
var setup = function() {
weaponXHR.open("GET", "http://udacity.com/media/js/standalone/libs/gamedev_assets/weapon.json", true);
weaponXHR.onload = function(){
return parseJSON(this.responseText);
}
weaponXHR.send();
};