Skip to content

Commit 296ff3d

Browse files
committed
校对
1 parent e657009 commit 296ff3d

File tree

2 files changed

+5
-162
lines changed

2 files changed

+5
-162
lines changed

Git/git-en.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ This is not for rookie, we'll introduce somthing about more advanced.
22
## Merge with Rebase
33
This command shows no difference with the command `merge`.
44

5-
We usually use `merge` to merge the code from one branch to `master`. like this:
5+
We usually use `merge` to merge the code from one branch to `master` , like this:
66

77
![](https://user-gold-cdn.xitu.io/2018/4/23/162f109db27be054?w=505&h=461&f=png&s=22796)
88

9-
After using `rebase` the commits from `decelop` will be moved to the third `commit` of the `master` in order, as follows:
9+
After using `rebase ` , the commits from `decelop` will be moved to the third `commit` of the `master` in order, as follows:
1010

1111
![](https://user-gold-cdn.xitu.io/2018/4/23/162f11cc2cb8b332?w=505&h=563&f=png&s=26514)
1212

@@ -18,13 +18,13 @@ You should use `rebase` on the local branchs which need be rebased. If you need
1818
## branch develop
1919
git rebase master
2020
get checkout master
21-
## 用于将 `master` 上的 HEAD 移动到最新的 commit
21+
## move HEAD on `master` to the latest commit
2222
get merge develop
2323
```
2424

2525
## stash
2626

27-
Use `git stash` to save the current state of the working directory while you want to fix a temporary bug in development, if you don't want to use `commit`.
27+
Use `git stash` to save the current state of the working directory while you want to check out branch, if you don't want to use `commit`.
2828

2929
```shell
3030
git stash
@@ -59,4 +59,4 @@ If you want to delete the last commit, you can do like this:
5959
```shell
6060
git reset --hard HEAD^
6161
```
62-
But this command doesn't delete the commit, it just reset the HEAD and the right branch the HEAD directing.
62+
But this command doesn't delete the commit, it just reset the HEAD and branch.

JS/JS-en.md

-157
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
- [instanceof](#instanceof)
66
- [scope](#scope)
77
- [Prototypes](#Prototypes)
8-
- [Modular](#Modular)
98

109
#### Built-in Types
1110
JavaScript defines seven built-in types, which can be broken down into two categories: `Primitive Type` and `Object`.
@@ -75,74 +74,6 @@ let undefined = 1
7574
a === void 0
7675
```
7776

78-
#### Type conversion
79-
80-
##### Convert to Boolean
81-
82-
Except to `undefined`, `null`, `false`, `NaN`, ````, `0`, `-0`, all other values ​​are converted to `true`, including all objects.
83-
84-
##### Object to basic type
85-
86-
When converting basic types of objects, the first calls `valueOf` and then call `toString`. And these two methods you can rewrite.
87-
88-
```js
89-
let a = {
90-
valueOf() {
91-
return 0
92-
}
93-
}
94-
```
95-
96-
##### Four operators
97-
98-
Only when adding, one of which is a string type, the other will be converted to a string type. As long as one of the other operations is a digit, the other party will change to a digit. And addition operation will trigger three types of conversion: the value is converted to the original value、 number & string.
99-
100-
```js
101-
1 + '1' // '11'
102-
2 * '2' // 4
103-
[1, 2] + [2, 1] // '1,22,1'
104-
// [1, 2].toString() -> '1,2'
105-
// [2, 1].toString() -> '2,1'
106-
// '1,2' + '2,1' = '1,22,1'
107-
```
108-
109-
For the addition sign need to pay attention to this expression `'a' + + 'b'`
110-
111-
```js
112-
'a' + + 'b' // -> "aNaN"
113-
// because of ++ 'b' -> NaN
114-
// you may have seen + '1' -> 1
115-
```
116-
117-
##### `==` operators
118-
119-
![](https://user-gold-cdn.xitu.io/2018/3/30/16275cb21f5b19d7?w=1630&h=1208&f=png&s=496784)
120-
121-
Figure above `toPrimitive` is the Object to basic type。
122-
123-
It is recommended to use `===` to determine two values, but you want to know if a value is or not `null`, you can use `xx == null` to compare.
124-
125-
Here to resolve a topic `[] == ![] // -> true`, follow is the steps that why this expression as `true`:
126-
127-
```js
128-
// [] convert to true,then revert to false
129-
[] == false
130-
// according to 8
131-
[] == ToNumber(false)
132-
[] == 0
133-
// according to 10
134-
ToPrimitive([]) == 0
135-
// [].toString() -> ''
136-
'' == 0
137-
// according to 6
138-
0 == 0 // -> true
139-
```
140-
141-
##### Comparison operators
142-
143-
1. If it‘s an object, through `toPrimitive` to convert to object.
144-
2. If it‘s a string, Compare with the `unicode` character index.
145-
14677
#### New
14778

14879
1. Create a new object
@@ -597,94 +528,6 @@ var obj = {a: 1, b: {
597528
const clone = await structuralClone(obj);
598529
```
599530
600-
#### Modular
601-
602-
In a Babel environment, we can use the modularity of ES6 directly
603-
604-
```js
605-
// file a.js
606-
export function a() {}
607-
export function b() {}
608-
// file b.js
609-
export default function() {}
610-
611-
import {a, b} from './a.js'
612-
import XXX from './b.js'
613-
```
614-
615-
##### CommonJS
616-
617-
`CommonJs` is a unique specification of Node, which requires `Browserify` to be used in browser.
618-
619-
```js
620-
// a.js
621-
module.exports = {
622-
a: 1
623-
}
624-
// or
625-
exports.a = 1
626-
627-
// b.js
628-
var module = require('./a.js')
629-
module.a // -> log 1
630-
```
631-
632-
In the above code,`module.exports` & `exports` easily confused,the following is a rough example of implementation
633-
:
634-
635-
```js
636-
var module = require('./a.js')
637-
module.a
638-
// Here is actually a layer of immediate execution function, so it will not pollute the global variables
639-
// the important thing is module that is a variable unique to Node.
640-
module.exports = {
641-
a: 1
642-
}
643-
// implementation
644-
var module = {
645-
exports: {} // exports a empty object
646-
}
647-
// This is why exports and module.exports are used similarly
648-
var exports = module.exports
649-
var load = function (module) {
650-
// Exported structure
651-
var a = 1
652-
module.exports = a
653-
return module.exports
654-
};
655-
```
656-
657-
let talk about `module.exports` & `exports`,
658-
its practical method is similar, will not have any effect if direct change the values that `exports`.
659-
660-
661-
The difference between `CommonJS` & the modularity of ES6 is:
662-
663-
- The former supports dynamic import, that is `require(${path}/xx.js)`, the latter does not currently support, but there are has proposals.
664-
- The former is a synchronous import, because its use for the Server, the files are all local, and even if the main thread is stuck, the impact of synchronous import is not great. The latter is asynchronous import, because its use for the browser, its need to download the file, if you also use the import will have a great impact on the rendering
665-
666-
- The former is a value copy when exporting. Even if the exported value is changed, the value that imported will not be changed. Therefore, if you want to update the value, you must need to import it again. However, the latter adopts the real-time binding method. The imported and exported values ​​all point to the same memory address, so the imported value will change follow the export value.
667-
- The latter will be compiled to `require/exports` to be executed
668-
669-
##### ADM
670-
671-
AMD was proposed by `RequireJS`
672-
673-
```js
674-
// AMD
675-
define(['./a', './b'], function(a, b) {
676-
a.do()
677-
b.do()
678-
})
679-
define(function(require, exports, module) {
680-
var a = require('./a')
681-
a.doSomething()
682-
var b = require('./b')
683-
b.doSomething()
684-
})
685-
686-
```
687-
688531
#### the differences between call, apply, bind
689532
690533
Firstly, let’s tell the difference between the former two.

0 commit comments

Comments
 (0)