MAD9022 Refactoring Practice

Size
2,315 Kb
Views
30,360

How do I make an mad9022 refactoring practice?

Use this pen to practice wrapping all your JS code in a single namespace. Then use it to try and convert your XMLHttpRequest into a FETCH API call.. What is a mad9022 refactoring practice? How do you make a mad9022 refactoring practice? This script and codes were developed by Mobile Application Design-Development on 10 August 2022, Wednesday.

MAD9022 Refactoring Practice Previews

MAD9022 Refactoring Practice - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>MAD9022 Refactoring Practice</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <section> <h1>Refactoring Code</h1> <p>Use this page as a test for refactoring your JavaScript into a more modular page.</p> <p>Fork the Pen then try to convert the code into a single object called app.</p> <p>Once that works, try to refactor the code again to use "use strict"; and the FETCH API instead of XMLHttpRequest</p> <p>XMLHttpRequest reference - https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#XMLHttpRequest()</p> <p>Fetch API primer - https://davidwalsh.name/fetch</p> <p>Loading JSON data...</p>
</section> <script src="js/index.js"></script>
</body>
</html>

MAD9022 Refactoring Practice - Script Codes CSS Codes

*{ box-sizing:border-box;
}
body{ font-family:Calibri, Helvetica, sans-serif;
}
p:last-child{ font-size: 120%; font-weight: 900;
}

MAD9022 Refactoring Practice - Script Codes JS Codes

function init(){ var xhr = new XMLHttpRequest(); //xhr.open("GET", "http://echo.jsontest.com/username/steve/id/12313/course/mad9022/", true); xhr.open("GET", "http://griffis.edumedia.ca/demo/the-data.json"); xhr.addEventListener("load", gotResponse); xhr.addEventListener("error", failed); xhr.send();
}
function gotResponse( ev ){ document.querySelector("p:last-child").textContent = ev.target.responseText; var data = JSON.parse( ev.target.responseText ); console.dir(data);
}
function failed(ev){ console.log("An error occurred"); console.dir(ev); //look in here for the error message and code
}
document.addEventListener("DOMContentLoaded", init);
MAD9022 Refactoring Practice - Script Codes
MAD9022 Refactoring Practice - Script Codes
Home Page Home
Developer Mobile Application Design-Development
Username mad-d
Uploaded August 10, 2022
Rating 3
Size 2,315 Kb
Views 30,360
Do you need developer help for MAD9022 Refactoring Practice?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Mobile Application Design-Development (mad-d) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!