JS, DOM, webapplication question
1.similarities between Javascript and python/Java/C? What differences?
2.thoughts on type coercion in Javascript? Do you see any benefits? Any drawbacks?
3.advantages using someElement.addEventListener("someEvent", someFunction) has over someElement.someEvent = someFunction ?
4. scalability, latency, and robustness (ability to handle failure, uncertainty, stress, etc.) as key concerns in designing and implementing web applications. Explain how you think various properties of the HTTP protocol (e.g., statelessness, headers, caching) relate to or address these key concerns.
5. a basic HTTP interaction, where the initial HTML is loaded during the first request/response cycle, and then various other pieces of the page are loaded using subsequent requests/responses. advantages of loading the information this way? Why do you think the pieces are loaded using multiple requests instead of integrating all of the data into the first response?
Answer(1):
Javascript:
Java:
Answer(2):
Type coercion is the process of converting value from one type to another (such as string to number, object to boolean, and so on). Any type, be it primitive or an object, is a valid subject for type coercion. To recall, primitives are: number, string, boolean, null.
Drawbacks:
Since JavaScript is a weakly-typed language, values can also be converted between different types automatically, and it is called implicit type coercion. It usually happens when you apply operators to values of different types.
Benefits:
It's really very simple. When you ask a value to work with an operator it does not respect (like adding an object to a number), or when you ask two values that don't work with each other to work with each other (adding a number and a string), JavaScript tries to convert either or both types to make it work.
Answer(3):
Answer(4):
Stateless:
The Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, hypertext information systems. This document defines HTTP caches and the associated header fields that control cache behavior or indicate cacheable response messages.
HTTP is typically used for distributed information systems, where performance can be improved by the use of response caches. This document defines aspects of HTTP/1.1 related to caching and reusing response messages.
Caching:
An HTTP cache is a local store of response messages and the subsystem that controls storage, retrieval, and deletion of messages in it. A cache stores cacheable responses in order to reduce the response time and network bandwidth. Any client or server may employ a cache, though a cache cannot be used by a server.
Headers:
A response to the HEAD method is identical to what an equivalent request made with a GET would have been, except it lacks a body. This property of HEAD responses can be used to invalidate or update a cached GET response, if the more efficient conditional GET request mechanism is not available (due to no validators being present in the stored response) or if transmission of the representation body is not desired even if it has changed.
Answer(5):
Get Answers For Free
Most questions answered within 1 hours.