Web Flashcards

1
Q

What happens when you click a link

A
  1. You type “maps.google.com” in the address bar of your browser.
  2. The browser checks the browser cache, OS cache, router cache and ISP cache for a DNS record to find the corresponding IP address of maps.google.com.
  3. If the browser doesn’t find the DNS record in any of the caches, it asks the ISP which has its own DNS server.
  4. If the URL is not in the ISP cache, the ISP DNS server initiates a DNS query. This is a recursive search from DNS server to DNS server which continues until either the IP address is found, or an error response is returned saying it was unable to find it.
  5. If the IP address is found, it is sent to the browser.
  6. The browser initiates a TCP connection with the server that matches the IP address. This is called the TCP/IP three-way handshake. It’s a three-step process where the client and server exchange SYN (synchronize) and ACK (acknowledge) messages to establish a connection.1) Client sends a SYN packet to the server asking if it’s open for new connections
    2) If the server has open ports that accept and initiate new connections, it will respond with an ACK of the SYN packet using a SYN/ACK packet.
    3) The client will receive the SYN/ACK packet from the server and will acknowledge it by sending an ACK packet.

The TCP connection has been established.

  1. The browser sends an HTTP request to the web server. It could be a GET or a POST.
  2. The server contains a web server which receives the request from the browser and passes it to a request handler to read and generate a response.
  3. The server sends an HTTP response which contains the requested web page as well as status code, compression type, how to cache the page, any cookies to set, privacy information, etc.
  4. The browser displays the HTML content in phases. Ir renders the bare bones HTML skeleton. Then it checks the HTML tags and sends GET requests for additional elements on the page. These static files are cached by the browser so it doesn’t have to fetch them the next time you visit the page.
  5. maps.google.com appears on the browser.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

JavaScript: difference between == and ===

A

==

  • performs implicit type conversion to check if values are equal to each other.
  • converts the values to true or false boolean values and then compare them.
  • can get weird results

===

  • checks that two values are of the same type
  • does not perform type conversion
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

JavaScript: 0.1 + 0.2 === 0.3

A
  • output is “false” because of floating point errors in internally representing certain numbers
  • can be remedied by rounding the results when doing arithmetic with decimal numbers.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is JavaScript

A

lightweight, interpreted programming language with object-oriented capabilities that allows you to build interactivity into otherwise static HTML pages

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

JavaScript: create an object

A
var object = 
        { 
         name: "obj",
         age: 10
         };
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

JavaScript: function types

A

named

anonymous

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

JavaScript: forEach

A

built-in method which calls a function for each element in an array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

JavaScript: read and write properties of an object

A

use dot (.) notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

JavaScript: case sensitive

A

JavaScript is case sensitive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

JavaScript: features

A
  • lightweight, interpreted programming language.
  • designed for creating network-centric applications.
  • complementary to and integrated with Java.
  • complementary to and integrated with HTML.
  • open and cross-platform.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly