diff --git a/Browser/browser-en.md b/Browser/browser-en.md index daa7b5e8..20271764 100644 --- a/Browser/browser-en.md +++ b/Browser/browser-en.md @@ -22,7 +22,7 @@ - [Storage](#storage) - [cookie,localStorage,sessionStorage,indexDB](#cookielocalstoragesessionstorageindexdb) - [Service Worker](#service-worker) -- [Rendering machanism](#rendering-machanism) +- [Rendering mechanism](#rendering-mechanism) - [Difference between Load & DOMContentLoaded](#difference-between-load--domcontentloaded) - [Layers](#layers) - [Repaint & Reflow](#repaint--reflow) @@ -445,7 +445,7 @@ Refreshing the page, we can see that our cached data is read from the Service Wo ![](https://user-gold-cdn.xitu.io/2018/3/28/1626b20e4f8f3257?w=2818&h=298&f=png&s=74833) -# Rendering machanism +# Rendering mechanism The machanism of the browser engine usually has the following steps: diff --git a/InterviewMapMind-en.png b/InterviewMapMind-en.png new file mode 100644 index 00000000..c72a98ea Binary files /dev/null and b/InterviewMapMind-en.png differ diff --git a/InterviewMapMind.png b/InterviewMapMind.png new file mode 100644 index 00000000..efb784b0 Binary files /dev/null and b/InterviewMapMind.png differ diff --git a/JS/JS-en.md b/JS/JS-en.md index cdbd2b2f..8375b918 100644 --- a/JS/JS-en.md +++ b/JS/JS-en.md @@ -10,12 +10,6 @@ - [`==` operator](#-operator) - [Comparison Operator](#comparison-operator) - [Typeof](#typeof) -- [Type Conversion](#type-conversion-1) - - [Converting to Boolean](#converting-to-boolean-1) - - [Objects to Primitive Types](#objects-to-primitive-types-1) - - [Arithmetic Operators](#arithmetic-operators-1) - - [`==` operator](#-operator-1) - - [Comparison Operator](#comparison-operator-1) - [New](#new) - [This](#this) - [Instanceof](#instanceof) @@ -29,6 +23,7 @@ - [Modularization](#modularization) - [CommonJS](#commonjs) - [ADM](#adm) +- [The differences between call, apply, bind](#the-differences-between-call-apply-bind) - [simulation to implement `call` and `apply`](#simulation-to-implement---call-and--apply) - [Promise implementation](#promise-implementation) - [Generator Implementation](#generator-implementation) @@ -182,76 +177,6 @@ let undefined = 1 a === void 0 ``` -# Type Conversion - -## Converting to Boolean - -Except `undefined`, `null`, `false`, `NaN`, `''`, `0`, `-0`, all of the values, including objects, are converted to `true`. - -## Objects to Primitive Types - -When objects are converted, `valueOf` and `toString` will be called, respectively in order. These two methods can also be overridden. - -```js -let a = { - valueOf() { - return 0 - } -} -``` - -## Arithmetic Operators - -Only for additions, if one of the parameters is a string, the other will be converted to the string as well. For all other operations, as long as one of the parameters is a number, the other will be converted to a number. - -Additions will invoke three types of type conversions: to primitive types, to numbers, and to string. - -```js -1 + '1' // '11' -2 * '2' // 4 -[1, 2] + [2, 1] // '1,22,1' -// [1, 2].toString() -> '1,2' -// [2, 1].toString() -> '2,1' -// '1,2' + '2,1' = '1,22,1' -``` - -Note the expression `'a' + + 'b'` for addition. - -```js -'a' + + 'b' // -> "aNaN" -// since ++ 'b' -> NaN -// You might have seen + '1' -> 1 -``` - -## `==` operator - -![](https://user-gold-cdn.xitu.io/2018/3/30/16275cb21f5b19d7?w=1630&h=1208&f=png&s=496784) - -`toPrimitive` in the above figure is converting objects to primitive types. - -`===` is usually recommended to compare to values. However, if you would like to know if a value is `null`, you can use `xx == null`. - -Let's take a look at an example `[] == ![] // -> true`. The following explains why the expression evaluates to `true`. - -```js -// [] converting to true, then take the opposite to false -[] == false -// with #8 -[] == ToNumber(false) -[] == 0 -// with #10 -ToPrimitive([]) == 0 -// [].toString() -> '' -'' == 0 -// with #6 -0 == 0 // -> true -``` - -## Comparison Operator - -1. If it's an object, `toPrimitive` is used. -2. If it's a string, `unicode` character index is used to compare. - # New 1. Create a new object @@ -787,6 +712,7 @@ define(function(require, exports, module) { var b = require('./b') b.doSomething() }) +``` # The differences between call, apply, bind @@ -816,7 +742,7 @@ We can consider how to implement them from the following points * If the first parameter isn’t passed, then the first parameter will default to `window` * Change what `this` refers to, which makes new object capable of executing the function. Then let’s think like this: add a function to a new object and then delete it after the execution. -```js +​```js Function.prototype.myCall = function (context) { var context = context || window // Add an property to the `context` @@ -834,7 +760,7 @@ Function.prototype.myCall = function (context) { The above is the main idea of simulating `call`, and the implementation of `apply` is similar. -```js +​```js Function.prototype.myApply = function (context) { var context = context || window context.fn = this diff --git a/Network/Network_en.md b/Network/Network_en.md index 757f2ba3..b9a286e4 100644 --- a/Network/Network_en.md +++ b/Network/Network_en.md @@ -11,7 +11,7 @@ - [Header](#header) - [State machine](#state-machine) - [Three-way handshake in opening a connection](#three-way-handshake-in-opening-a-connection) - - [Four-handshake of disconnect.](#four-handshake-of-disconnect) + - [Four-handshake of disconnect](#four-handshake-of-disconnect) - [ARQ protocol](#arq-protocol) - [Stop-and-Wait ARQ](#stop-and-wait-arq) - [Continuous ARQ](#continuous-arq) @@ -26,13 +26,14 @@ - [HTTP](#http) - [Difference between POST & GET](#difference-between-post--get) - [Common Status Code](#common-status-code) + - [Common Fields](#common-fields) - [HTTPS](#https) - [TLS](#tls) - [HTTP/2](#http2) - [Binary Transport](#binary-transport) - [MultiPlexing](#multiplexing) - [Header compression](#header-compression) - - [server push](#server-push) + - [Server push](#server-push) - [QUIC](#quic) - [DNS](#dns) - [What happens when you navigate to an URL](#what-happens-when-you-navigate-to-an-url) @@ -130,7 +131,7 @@ Imagine that, the client sends a connect request called A, but the network is ba PS: Through connecting, if any end is offline, it needs to retransmit, generally, five times. You can limit the times of retransmitting or refuse the request if can't handle it. -### Four-handshake of disconnect. +### Four-handshake of disconnect ![](https://user-gold-cdn.xitu.io/2018/5/2/1631fb807f2c6c1b?w=640&h=512&f=png&s=31059) @@ -318,6 +319,8 @@ Technically: - 501 Not Implemented: The server cannot fulfil the request. - 503 Service Unavailable: The server is currently unavailable because it is overloaded or down for maintenance. +## Common Fields + | Common Fields | Description | | :---------------: | :----------------------------------------------------------: | | Cache-Control | It tells caching mechanisms | @@ -445,7 +448,7 @@ In HTTP/1. X, we transfer data of the header by plain text. In the case where th In HTTP 2.0, the header of the transport was encoded using the HPACK compression format, reducing the size of the header. The index table is maintained at both ends to record the occurrence of the header. The key name of the already recorded header can be transmitted during the transmission. After receives the data, the corresponding value can be found by the key. -## server push +## Server push In HTTP/2, the server can push resources to the client without the client having to request. Imagine that, something in the server is necessary for the client, so the server can push the associated resources ahead of time to reduce the delay time. By the way, we can also use `pre-fetch` if the client is compatible. diff --git a/README-ZH.md b/README-ZH.md index 35004d36..0fd69c6e 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -43,7 +43,7 @@ # 大纲 -![mind](./mind.png) +![mind](./InterviewMapMind.png) ## 贡献 @@ -70,7 +70,7 @@ ## 支持我们 -如果图谱在面试中或者学习中帮助到你了,你可以请我 [支持我们的工作](https://github.com/KieSun/InterviewMap/issues/20) +如果图谱在面试中或者学习中帮助到你了,你可以 [支持我们的工作](https://github.com/KieSun/InterviewMap/issues/20) ## 协议 diff --git a/README.md b/README.md index 829956a0..f35ec5fb 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ The contents of the repository will update continuously, and more contents will # Outline -![mind](./mind.png) +![mind](./InterviewMapMind-en.png) ## Contributing diff --git a/Safety/safety-en.md b/Safety/safety-en.md index c1d79e58..b5ab4775 100644 --- a/Safety/safety-en.md +++ b/Safety/safety-en.md @@ -10,7 +10,7 @@ - [How to attack](#how-to-attack-1) - [How to defend](#how-to-defend-1) - [SameSite](#samesite) - - [Verify Referer](#verify--referer) + - [Verify Referer](#verify-referer) - [Token](#token) - [Password security](#password-security) - [Add salt](#add-salt) @@ -136,7 +136,7 @@ There are several rules for defending against CSRF: The `SameSite` attribute can be set on cookies. This attribute sets the cookie not to be sent along with cross-domain requests. This attribute can greatly reduce the CSRF attack, but this attribute is currently not compatible with all browsers. -#### Verify Referer +#### Verify Referer For requests that need protection against CSRF, we can verify the Referer to determine if the request was initiated by a third-party website. diff --git a/mind.png b/mind.png deleted file mode 100644 index 9758e294..00000000 Binary files a/mind.png and /dev/null differ