2021年10月14日
摘要: // eslint-disable-next-line no-extend-native Function.prototype.myCall = function (...args) { const target = args[0] target._f = this target._f(...arg 阅读全文
posted @ 2021-10-14 10:23 hhvfg 阅读(49) 评论(0) 推荐(0)
  2021年10月13日
摘要: // const F = function () {} function F(){} // eslint-disable-next-line no-new-func // const F = new Function() // eslint-disable-next-line no-extend-n 阅读全文
posted @ 2021-10-13 09:26 hhvfg 阅读(33) 评论(0) 推荐(0)
  2021年9月22日
摘要: 收集依赖 侦测变化 触发更新 阅读全文
posted @ 2021-09-22 11:22 hhvfg 阅读(14) 评论(0) 推荐(0)
  2021年9月9日
摘要: // const test = {} // Object.defineProperty(test,'test',{ // value: 'test', // enumerable: true, // writable: true, // configurable: true // 可配置的,就是能用 阅读全文
posted @ 2021-09-09 22:46 hhvfg 阅读(52) 评论(0) 推荐(0)
摘要: const arr = [1, 2, 3, 4] const p = [] const res = [] const visited = new Array(arr.length).fill(false) const f = (depth) => { if (depth.length arr.len 阅读全文
posted @ 2021-09-09 11:30 hhvfg 阅读(51) 评论(0) 推荐(0)
摘要: // 找出最长的回文子串 let s = 'ac' const judge = (s) => { let arr = Array.from(s) let mid = 0 if (arr.length % 2 0 ) { mid = arr.length / 2 -1 } else { mid = M 阅读全文
posted @ 2021-09-09 10:28 hhvfg 阅读(19) 评论(0) 推荐(0)
摘要: // 不含重复元素的最长子串长度 let s = 'abcabbcb' const judge = (s) => { return Array.from(s).length Array.from(new Set(s)).length? true: false } const f = (s) => { 阅读全文
posted @ 2021-09-09 10:17 hhvfg 阅读(69) 评论(0) 推荐(0)
摘要: const arrSum = (arr) => { return arr.reduce((a, b) => { return a+b }, 0) } const f = (arr) => { // ..... let max = -Infinity for (let i = 0;i < arr.le 阅读全文
posted @ 2021-09-09 09:50 hhvfg 阅读(25) 评论(0) 推荐(0)
  2021年9月8日
摘要: 这部分功能的实现过程中,笔者遇到了一个问题。 原本的drawShot函数是这么写的: const drawShot = () => { // cancelAnimationFrame(handle) // cRole.clearRect(0, 0, WIDTH, HEIGHT) // drawRol 阅读全文
posted @ 2021-09-08 14:56 hhvfg 阅读(128) 评论(0) 推荐(0)
摘要: 当按下空格键时,有两个步骤。首先绘创建一个子弹类的实例,塞入子弹库数组 Ammunition中,其中的getAmmunPix函数用于根据当前role的位置和方向,确认枪口的位置。。然后调用drawShot函数执行,绘制出弹药库中的所有子弹类实例。drawShot函数如下所示: // 空格键触发射击动 阅读全文
posted @ 2021-09-08 14:44 hhvfg 阅读(91) 评论(0) 推荐(0)