- 熟悉 VS Code,注意几个常用插件的配置
- 熟悉 html 页面结构 ( 强调 doctype ), 注意 html规范
- 使用 Chrome dev tools 调试 CSS, HTML
- 使用 jsbin.com 写自己的 demo 页面
- reset.css 例如 normalize.css (为什么会有rest.css 和 浏览器的差异性)
- 盒模型
- CSS Layout 一些知识 传送门
- block, inline 和 inline-block 元素特点
| function range(start, end, step) { | |
| if (arguments.length === 0) { | |
| throw new Error('range fuction expect at least 1 argument') | |
| } | |
| if (arguments.length === 1) { | |
| end = start | |
| start = 0 | |
| step = 1 |
| function genArray(rows, cols, something) { | |
| // BAD! Rows are copied by reference | |
| // return new Array(rows).fill(new Array(cols).fill(something)) | |
| // good way | |
| Array.from(Array(rows), () => new Array(cols).fill(something)) | |
| // more inefficient 12% | |
| // return new Array(rows).fill(null).map(() => Array(cols).fill(something)) | |
| } |
1.递归
function recur(level, params...) {
// 终止条件
if (level < maxLevel) {
process_result
return
}
// 处理当前层| function generatePassword(length) { | |
| let charsets = ['ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz', '0123456789', '!#$%&*'] | |
| let allCharsets = charsets.join('') | |
| let retVal = '' | |
| for (let i = 0, len = charsets.length; i < len; i++) { | |
| let n = charsets[i].length |
| function base58(encodeMap) { | |
| function base58encode(int64: string): string { | |
| let num = BigInt(int64) | |
| const base = 58n | |
| let res = '' | |
| while (num >= base) { | |
| res += encodeMap[num % base] | |
| num = num / base | |
| } |
| // Sequence generator function (commonly referred to as "range", e.g. Clojure, PHP etc) | |
| const range = (start, stop, step) => Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step)); | |
| // create 2d array | |
| const create2DArray = (m, n, initVal) => Array.from(new Array(m), () => new Array(n).fill(initVal)) | |
| // create 3d array | |
| const create3DArray = (m, n, d, initVal) => Array.from(new Array(m), () => Array.from(new Array(n), () => new Array(d).fill(initVal))) |
| class PriorityQueue { | |
| constructor(data = [], compare = defaultCompare) { | |
| this.data = data | |
| this.length = this.data.length | |
| this.compare = compare | |
| if (this.length > 0) { | |
| for (let i = (this.length >> 1) - 1; i >= 0; i--) this._down(i) | |
| } | |
| } |
利用js-xlsx来导出excel,纯前端实现实现