uaison
uaison
```js var arr = [1,2,,3]; arr.length = 4; // 题1 arr.filter(item => !item.prototype); // 题2 var arr2 = arr.map(parseInt); /*题3 map前两个参数为 value, index; parseInt两个参数:数字,进制; 相当于执行parseInt(1,0);parseInt(2,1);parseInt(empty, 2); parseInt(3, 3); 结果: [1,...
修改 ```js function isSameType(obj1, obj2) { // 是否相同类型 return Object.prototype.toString.call(obj1) === Object.prototype.toString.call(obj2); } function equalObject(obj1, obj2) { // 第一题 if(!isSameType(obj1, obj2)) return false; let keys1 = Object.keys(obj1); let keys2 =...
```js // zhangxinxu: 有bug Element.prototype.closest = Element.prototype.closest || function(selector) { /* 修改开始: 若没传参,返回最近父级元素 */ if(!selector) return this.parentNode; // if(!selector) return this; /* 修改结束 */ var el = document.querySelectorAll(selector); if(el.length ===...
查看demo:[copen.io在线链接](https://codepen.io/uaison/pen/YgozYb) ```html 提案笙 10月30日 22:47:00 什么秘密,我觉得你现在跟我说什么都没有意义。 提淮南王铃 10月8日 10:30 @蝴蝶蓝 优秀 蝴蝶蓝 昨天 22:13 值得一听 ~ ~ Y优秀X 刚刚 围观戏精现场 ``` ```css html { font-size: 62.5%; font-family: "Microsoft Yahei"; }...
### 第一题 ```js strTel.trim(); ``` ### 第二题 ```js //zxx: 只有+86才替换哦~ // 替换+号和两位数字开头 strTel.replace(/^(\+\d{2})/, ''); ``` ### 第三题 ```js // '0'.charCodeAt() - '0'.charCodeAt() = 65248,使用String.fromCharCode()获取半角数字 strTel.replace(/[\uFF10-\uFF19]/g, $ => String.fromCharCode($.charCodeAt() - 65248));...
[Code Pen 在线demo](https://codepen.io/uaison/pen/xedGZa) ```js (function(window, document) { // 第一题 var body = document.body; var slider = createElement("div", "slider"); var track = createElement("div", "slider-track"); var thumb = createElement("div", "slider-thumb"); slider.appendChild(track).appendChild(thumb); body.appendChild(slider);...
```js // 第一题 content.length > 140 // 第二题 content.trim().replace(/[\r,\n,\s]{2,}/g, " ").length > 140 // 第三题 content.trim().replace(/[\r,\n,\s]{2,}/g, " ").replace(/[\x00-\x7f]{2}/g, " ").length > 140 // 第四题 content.trim().replace(/https?:\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/g, '*'.repeat(10)).replace(/[\r,\n,\s]{2,}/g, " ").replace(/[\x00-\x7f]{2}/g, " ").length...