Skip to content

Commit

Permalink
release v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
YuChengKai committed Jul 15, 2018
1 parent 9ecaf96 commit 03ac689
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 89 deletions.
4 changes: 2 additions & 2 deletions Browser/browser-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:

Expand Down
Binary file added InterviewMapMind-en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added InterviewMapMind.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 4 additions & 78 deletions JS/JS-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -787,6 +712,7 @@ define(function(require, exports, module) {
var b = require('./b')
b.doSomething()
})
```
# The differences between call, apply, bind
Expand Down Expand Up @@ -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`
Expand All @@ -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
Expand Down
11 changes: 7 additions & 4 deletions Network/Network_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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 |
Expand Down Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

# 大纲

![mind](./mind.png)
![mind](./InterviewMapMind.png)

## 贡献

Expand All @@ -70,7 +70,7 @@

## 支持我们

如果图谱在面试中或者学习中帮助到你了,你可以请我 [支持我们的工作](https://github.com/KieSun/InterviewMap/issues/20)
如果图谱在面试中或者学习中帮助到你了,你可以 [支持我们的工作](https://github.com/KieSun/InterviewMap/issues/20)

## 协议

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Safety/safety-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.

Expand Down
Binary file removed mind.png
Binary file not shown.

0 comments on commit 03ac689

Please sign in to comment.