风轻云扬
风轻云扬
好巧啊 竟然碰到了学长
```JavaScript const flatten = x => x.reduce((pre, cur) => Array.isArray(cur) ? pre.concat(flatten(cur)) : pre.concat(cur), []); ```
使用正则 indexOf('/:>-|+?','/:>-|+?') 这个测试用例应该通不过
```JavaScript if (!Element.prototype.matches) { var eleProtoType = Element.prototype eleProtoType.matches = eleProtoType.webkitMatchesSelector || eleProtoType.msMatchesSelector || eleProtoType.mozMatchesSelector || eleProtoType.oMatchesSelector|| function(s) { var matches = (this.document || this.ownerDocument).querySelectorAll(s), i = matches.length; while (--i...
``` document.cookie document.cookie='userid=1' const expire=new Date(time+24*60*60*1000); document.cookie='userid=1;expires'+expire.toUTCString() decodeURIComponent([document.cookie.match(/;?(?
``` (function () { function checkIsDom(obj) { return obj && obj.nodeType && obj.nodeType === 1 && typeof obj.nodeName === 'string'; } function ScrollTopCheck(container, target) { if (!(this instanceof ScrollTopCheck)) {...
``` document['styleSheets'][1].type === 'text/css' document['head']['innerText'].replace(/\s/g, '') === 'DOM 小测 31 :root{}' document.querySelector('div:nth-of-type(1)').id === 'pageStart' document.querySelector('div:empty').className === 'hr' pageStart.querySelectorAll('div div').length === 3 6 空 document.querySelectorAll("div[class~='page']").length === 1 document.querySelectorAll("div:not([class])").length === 1 ```
[jsBin](https://jsbin.com/maseve/edit?html,css,output) ```HTML 1:23/4:33 ``` ```CSS .audio { height: 56px; border-radius: 28px; display: flex; background: #f1f3f4; padding: 12px; box-sizing: border-box; } body { background: black; } .pause, .vol, .more, .play {...
[JsBin在线Demo](https://jsbin.com/quqozuw/edit?html,css,js,output) ```JavaScript (function (window) { var SliderBar = function SliderBar(root, percent) { if (!root || root.nodeType !== Node.ELEMENT_NODE) { throw Error('请确保构造函数的第一个参数为DOM节点') } this.root = root; this.percent = percent || 0;...
[demo jsbin](https://jsbin.com/bisuruf/edit?html,js,output) ```javaScript // 1. 格式化手机号 function trimTel(str) { if (!str) { return str } const hasTrim = str.replace(/[\s-]/g, ''); return (/^\d{11}$/).test(hasTrim) ? hasTrim : str } console.error(trimTel('138-0013-8000')); console.error(trimTel('138 0013...