LYS

Results 21 issues of LYS

```javascript var a = {n: 1}; var b = a; a.x = a = {n: 2}; console.log(a.x) console.log(b.x) ``` 这是连续赋值的坑 - [参考资料](https://www.zhihu.com/question/41220520)

JS基础

```javascript let obj = {1:222, 2:123, 5:888}; obj.length = 12; let _obj = Array.from(obj).slice(1); let newObj = _obj.map((item) => {if(item === undefined) {return null;} else {return item;}}); console.log(newObj); ``` ```javascript...

编程题

```javascript var obj = { '2': 3, '3': 4, 'length': 2, 'splice': Array.prototype.splice, 'push': Array.prototype.push } obj.push(1) obj.push(2) console.log(obj) ``` 结果:[,,1,2], length为4 伪数组(ArrayLike)

JS基础

> 例如:给定 nums1 = [1, 2, 2, 1],nums2 = [2, 2],返回 [2, 2]。 ```javascript var nums1 = [1, 2, 2, 1], nums2 = [2, 2, 3, 4]; // 1. //...

编程题

1. clientHello 2. SeverHello 3. 客户端回应 4. 服务器的最后回应 [具体可以看这篇文章](http://www.ruanyifeng.com/blog/2014/02/ssl_tls.html)

网络

时间复杂度: n^2 ```javascript // 生成从l到r的数量为n的随机数组 function randomArr (n, l, r) { let arr = []; for (let i = 0; i < n; i++) { let _random = Math.round(l +...

编程题

```javascript LazyMan('Tony'); // Hi I am Tony LazyMan('Tony').sleep(10).eat('lunch'); // Hi I am Tony // 等待了10秒... // I am eating lunch LazyMan('Tony').eat('lunch').sleep(10).eat('dinner'); // Hi I am Tony // I am eating...

编程题