Skip to content

Commit ef612ff

Browse files
committed
Update:更新一下
1 parent ec0e606 commit ef612ff

31 files changed

+8115
-3291
lines changed

docs/.vuepress/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ module.exports = {
6464
{ text: '首页', link: '/' },
6565
{ text: '前端基础', link: '/interview/' },
6666
{ text: '进阶博文', link: '/blog/' },
67-
{ text: '大厂面经', link: 'https://juejin.im/post/5e65a953518825495a27860b' },
67+
{ text: '大厂面经', link: 'https://juejin.cn/post/7004638318843412493' },
6868
{ text: 'Github', link: 'https://github.com/lensh/blog' },
6969
{
7070
text: '项目',
95.2 KB
Loading
107 KB
Loading
82.6 KB
Loading
97.8 KB
Loading
110 KB
Loading
115 KB
Loading
58 KB
Loading
174 KB
Loading
Loading
98.8 KB
Loading
252 KB
Loading
161 KB
Loading
126 KB
Loading
132 KB
Loading
208 KB
Loading
53.7 KB
Loading
167 KB
Loading
114 KB
Loading
36.3 KB
Loading
113 KB
Loading
108 KB
Loading
131 KB
Loading
80.4 KB
Loading

docs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ features:
1212
details: 前端工程师进阶所需要学习的技能,在进阶之路上,共勉!
1313
- title: 大厂·面经
1414
details: 精选优质大厂面经,敲开大厂之门!
15-
footer: MIT Licensed | Copyright © 2020-present Qhan Luo
15+
footer: MIT Licensed | Copyright © 2022-present Qhan Luo
1616
---

docs/interview/coding/2.md

+1-42
Original file line numberDiff line numberDiff line change
@@ -72,45 +72,4 @@ console.log(foo.getX.apply(obj)); //81
7272
* apply 、 call 、bind 三者都是用来改变函数的this对象的指向的,第一个参数都是this要指向的对象,都可以利用后续参数传参。
7373
* bind不会立即调用,其他两个会立即调用,如果多次调用bind,那么第一次bind才会有效。
7474
## 5、手写实现
75-
```js
76-
Function.prototype.MyCall = function(context, ...args) {
77-
if (typeof this !== 'function') {
78-
throw new TypeError('Error')
79-
}
80-
context = context || window
81-
context.fn = this
82-
return context.fn(...args)
83-
}
84-
Function.prototype.MyApply = function(context, args) {
85-
if (typeof this !== 'function') {
86-
throw new TypeError('Error')
87-
}
88-
context = context || window
89-
context.fn = this
90-
return args ? context.fn(...args) : context.fn()
91-
}
92-
Function.prototype.MyBind = function(context) {
93-
if (typeof this !== 'function') {
94-
throw new TypeError('Error')
95-
}
96-
return (...args) => {
97-
context = context || window
98-
context.fn = this
99-
return args ? context.fn(...args) : context.fn()
100-
}
101-
}
102-
103-
var obj = {
104-
x: 81,
105-
};
106-
107-
var foo = {
108-
getX: function(y, z) {
109-
return this.x + y + z;
110-
}
111-
}
112-
113-
console.log(foo.getX.MyBind(obj)(1, 2)); //84
114-
console.log(foo.getX.MyCall(obj, 1, 2)); //84
115-
console.log(foo.getX.MyApply(obj, [1, 2])); //84
116-
```
75+
[参考](/interview/question/8.html#_50%E3%80%81%E6%89%8B%E5%86%99%E5%87%BD%E6%95%B0bind%E3%80%81call%E3%80%81apply)

docs/interview/js/2.md

+17-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
# 变量类型
2-
## 原始类型
3-
6 种原始类型:Boolean、String、Number、Null、Undefined、Symbol(ES6 新定义)。
1+
# 数据类型
2+
## 基本数据类型
3+
6 种基本数据类型:Boolean、String、Number、Null、Undefined、Symbol(ES6 新定义)。基本数据类型也叫原始类型。
4+
5+
typeof 对于原始类型来说,除了 null(null显示为Object) 都可以显示正确的类型。
46

57
原始类型存储的都是值,是没有函数可以调用的。但是'1'.toString()是可以使用的。其实在这种情况下,'1'已经不是原始类型了,而是被强制转换成了 String 类型也就是对象类型,所以可以调用 toString 函数。
68

79
另外对于 null 来说,很多人会认为他是个对象类型,其实这是错误的。虽然 typeof null 会输出 object,但是这只是 JS 存在的一个悠久 Bug。在 JS 的最初版本中使用的是32位系统,为了性能考虑使用低位存储变量的类型信息,000 开头代表是对象,然而 null 表示为全零,所以将它错误的判断为 object。虽然现在的内部类型判断代码已经改变了,但是对于这个 Bug却是一直流传下来。
810

911
[理解和使用ES6中的Symbol](https://www.jianshu.com/p/f40a77bbd74e)
10-
## 对象类型
11-
在 JS 中,除了原始类型那么其他的都是对象类型了。原始类型存储的是值,对象类型存储的是地址。
12+
## 引用类型
13+
引用类型:Object【Object是个大类,function函数、array数组、date日期...等都归属于Object】。
14+
15+
typeof 对于对象来说,除了函数(函数显示为function)都会显示object。
16+
17+
在 JS 中,除了基本数据类型那么其他的都是对象类型了。基本数据类型存储的是值,对象类型存储的是地址。
1218

1319
函数参数是对象的情况:
1420
```js
@@ -39,8 +45,13 @@ console.log(p2) // -> ?
3945
## typeof VS instanceof
4046
typeof 对于原始类型来说,除了 null(null显示为Object) 都可以显示正确的类型。
4147

42-
typeof 对于对象来说,除了函数(函数显示为function)都会显示object,所以说 typeof 并不能准确判断变量到底是什么类型
48+
typeof 对于对象来说,除了函数(函数显示为function)都会显示object,所以说 typeof 并不能准确判断对象是什么类型
4349

50+
记住typeof这两个特殊的就行:
51+
```js
52+
typeof null === 'object'
53+
typeof function(){} === 'function'
54+
```
4455
想判断一个对象的正确类型,这时候可以考虑使用instanceof,因为内部机制是通过原型链来判断的。
4556
## 类型转换
4657
在 JS 中类型转换只有三种情况,分别是:

0 commit comments

Comments
 (0)