A really good article talking about what a front-end engineer needs to know before an interview.
What happens when you type in www.google.com in your browser?
- when you want to connect to www.google.com, you need to get the IP address of the server where google web services are hosted. DNS (domain name system) resolves an URL to an IP address.
- check browser cache: browsers maintain cache of DNS records for some fixed duration.
- check OS cache
- check router cache
- check ISP cache
- Browser initiates TCP connection with the server
- Browser sends a HTTP GET request to the server
- GET request contains cookies, User-Agent and etc.
- Server handles the request
- HTML response is sent back to the client from corresponding request handler
- Browser receives HTTP response
- Browser renders DOM and it sends GET request to request img or CSS files and etc
what is hoisting?
hoisting means move variable and function declarations to the top so you will be able to call a function or use a variable before its declaration function declaration takes precedence on variable declaration
Difference between ‘null’ and ‘undefined’
undefined means a variable is declared but not assigned a value yet null means that programmers assign a null value to an object to represent there is none
The ‘arguments’ object
arguments is an array-like object that corresponds to the arguments passed in a function How can we turn this array-like ‘argument’ to an actual array? var args = Array.from(arguments); var args = […arguments];
What is IIFE? Why do we need to use it?
IIFE is immediately invoked function expression. the variables defined in IIFE is only accessible within IIFE, it prevents ‘var’ from polluting the global. in ES6, the keyword ‘let’ can be used to solve this problem