This week was algorithm heavy

What was something you learned this week?

We learned about programming with an API this week. Super useful and not too confusing while using fetch(). This can easily speed up projects by just utilizing the code someone else has already finished and provided you access to. Obviously preventing you from having to create portions that someone with more skill may have done already.

Why would you use something like the load event? Does this event have disadvantages? Do you know any alternatives, and why would you use those?

If you wanted something to wait until the entire DOM and its accompanying files had loaded completely before firing, using the load event will do that. It waits until everything has loaded before the event may fire. However if you just want the DOM itself to load but don’t mind if the accompanying stylesheet or script files had loaded, you could use DOMContentLoaded for that.

What are the advantages and disadvantages of using Ajax?

“AJAX increases the browser’s performance and facilitates faster browsing speed thereby providing a responsive user experience. Enhanced User Productivity — The AJAX library provides object-oriented helper functions that dramatically increase the productivity while decreasing frustration.” dzone

There are a few notable disadvantages though, for one AJAX doesn’t run on all browsers, looking at you Internet Explorer, and Google cannot index it for utilizing search engines. It can also run into some latency issues as well.

Explain how JSONP works (and how it’s not really Ajax).

JSONP is JSON with padding. “Requesting an external script from another domain does not have this problem. JSONP uses this advantage, and request files using the script tag instead of the XMLHttpRequest object.” w3schools

Ajax has to occur within the same domain, JSONP was created to do this with different domains being requested to and from.

What does it mean when we talk about time complexity of an algorithm?

This quantifies the amount of time taken by an algorithm to run as a function of the length of the input. So basically the amount of time it takes to run the algorithm.

What are the three laws of algorithm recursion?

  1. A recursive algorithm must have a base case.

How do you see yourself growing as a web developer?

Currently I see my daily struggles and how they are evolving very slowly to a minimal understanding of vanilla Javascript. How do I plan on growing as a developer? I plan to put in much more keyboard time to practice these things I’ve learned over the past 2 months. It’s a crazy amount of information we’ve taken in so far and I feel the need to play with it over and over to better understand.