In week one we will discuss the following topics:
• Structure for a basic SPA (Single Page Application)
• AJAX & XMLHttpRequests
• API calls
Here are resources that we like you to read as a preparation for the first lecture:
To refresh your DOM manipulation skills, watch this YouTube video series from Traversy Media:
You will be using these particular DOM manipulation methods and properties in the JS3 homework for the next three weeks:
document.getElementById()element.textContent
document.createElement()element.setAttribute()element.appendChild()
changeevent (<select>element)element.addEventListener()
Note that throughout the video lectures the presenter uses var to declare variables. We prefer that you use const and let instead in your homework.
In the homework we will be using the GitHub API. Learn about remote Web APIs in general from this YouTube video (18 min) from Traversy Media:
For more research, check out the following resources:
Please watch the first 45 mins of the Ajax Crash Course (up until the PHP examples) by Traversy Media:
The example code in this course is using on ES5 syntax. In the traversy_ajax_crash folder in this repo you will find updated example code (ajax1...ajax3) that use the ES6 syntax and styling that we prefer in HYF. Specifically, the following changes have been made:
- The JavaScript code has been placed in a separate file, loaded with a
<script>tag from the HTML file. - Instead of var to declare a variable, const and let are used.
- The non-strict equality operator
==has been replaced with the strict version===. - Functions are defined before they are used.
- Anonymous functions use the arrow syntax instead of the function keyword. Consequently, the
thisvalue inside the XMLHttpRequest event handlers have been replaced with thexhrvariable name. - The
for...inloops for iterating through an array have been replace withfor...of.
Read more about using XMLHttpRequest:
-
How to write clean code? Lessons learnt from “The Clean Code” — Robert C. Martin. Note that this article includes some code examples written in Java, but the same principles can equally be applied to JavaScript.
- HYF Fundamental - Handing in homework