Javascript p3 Flashcards
HTTP +
What three things are on the start-line of an HTTP request message?
- an HTTP method, that describes the action to be performed.
- the request target, usually a URL, or the absolute path of the protocol, port, and domain are usually characterized by the request context.
- the HTTP version, which defines the structure of the remaining message, acting as an indicator of the expected version to use for the response.
What three things are on the start-line of an HTTP response message?
- the protocol version, usually HTTP/1.1
- the status code, indicating success or failure of the request
- the status text, a brief informational textual description of the status code to help a human understand the HTTP msg
What are HTTP headers?
- similar to the head of an html doc, they hold specifics relevant to the data they head
- they let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon (:), then by its value.
Where would you go if you wanted to learn more about a specific HTTP Header?
MDN Web Docs ! :D
Is a body required for a valid HTTP request or response message?
– nope
What does the new operator do?
- it calls a constructor function to make a new object with properties based on values given as arguments
- it’s an instance of the object
- uses constructor function to make new instance of object, vs var newObj = obj.create(ogObj);
What property of JavaScript functions can store shared behavior for instances created with new?
- the Function.prototype property
- -
- x.prototype.prop = ‘value’;
- object.getPrototypeOf(x).prop;
What does the instanceof operator do?
– it checks if the object is a product of the given constructor function
- objX instanceof ObjectXMaker;
- returns true
tests to see if the prototype property of a constructor appears anywhere in the prototype chain of an object. returns boolean
What is a “callback” function?
A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action.
Besides adding an event listener callback function to an element or the document, what is one way to delay the execution of a JavaScript function until some point in the future?
– .setTimeout(func, delay)
How can you set up a function to be called repeatedly without using a loop?
- .setInterval(func, delay);
- - clearInterval(intervalID)
What is the default time delay if you omit the delay parameter from setTimeout() or setInterval()?
– 0, meaning execute immediately/next cycle
What do setTimeout() and setInterval() return?
a numeric, non-zero value which identifies the timer created by the call to setInterval()
What is AJAX?
- AJAX is a technique in webdev which allows a page to request data from a server and load it without having to reload the entire page
- selective reloading
- uses JSON/HTML/XML
- jQuery makes AJAX easier to use
What does the AJAX acronym stand for?
– the term Ajax is now used to
refer to a group of technologies that offer asynchronous functionality in the browser