BlogPost_207

Cody Blair
3 min readNov 13, 2020
  1. 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?

Sometimes you need to wait for the page to load for the element in question to properly do what it needs to do. If some code fires off before it’s corresponding elements are prepared for it to run, you will quickly find errors being thrown at you, and you might not know why. I had this problem recently, and found that by using a setTimeout function I was able to clear up a problem of mine. I’m sure there are disadvantages.

  1. What are the advantages and disadvantages of using Ajax?

You can send and retrieve data without refreshing your browser. This can be useful if you want to update information without sending another http request, allowing your site to update live. The example I watched was with twitter, refreshing to show you if any new tweets have popped up.

A quick disadvantage I saw that that the back button wont produce the same result, and the client can disable javascript.

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

If you want to request information from a server that has JSONP enabled, you can pass in a special parameter that tells the server a little about your page, and allows the server to respond with data that your page can handle. The data returned seems to be in the form of a function? Not sure about that. But the whole point is for you to be able to do cross-domain requests. A downside is that you lost a lot of control in your request, and CORS seems to be a better more widely used approach.

To me, it’s not even worth describing why it is not Ajax, as they are two completely different concepts in my mind. The only similarity, is that they are accessing a server and gathering information. To be honest, I don’t even see using JSONP as a likely part of my future, but we will see.

  1. Explain Ajax in as much detail as possible.

That’s what wiki is for https://en.wikipedia.org/wiki/Ajax_(programming)

I think it makes more sense to describe it in a concise manner. It’s asynchronous, it allows the page make data requests to the server as well as update the information on your page without refreshing the browser.

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

How efficient it is in best and worst case scenarios. Not all algorithms are created equal, nor does one fit every solution better than it’s counterparts. The more complex, the more time it takes for something to load, and its complexity can be a matter of x1 or x².

  1. What are the three laws of algorithm recursion?

This is literally a repeat question from 206. Nice one Clayton.

  1. How do you see yourself growing as a web developer?

That’s something I have been thinking about a lot lately. In my current state, I still am not much use to a professional team, at least in my opinion. I’m hoping that feeling changes soon, and that I will have a better understanding as to what kind of work I will be able to do once I get out of this program. I really want to learn more and more, and get to a point where I can find a comfortable position in the high-tech industry, but there is a long road ahead of learning before I get to that point.

--

--