![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
js
美彤柚子
这个作者很懒,什么都没留下…
展开
-
JS==>实现老鼠走迷宫问题
/** maze:迷宫 pos:位置 path:路径 transverse:老鼠走过的地方 **/ function rat_in_maze(maze, pos = [0, 0], path = [ [...pos] ], transverse = []) { const [x, y] = pos; if (maze[x][y] === 2) { //终点 return path; } // 记录走过当原创 2020-09-22 17:09:29 · 267 阅读 · 0 评论 -
JS之before的实现
function fun(a) { console.log(a + '后面') } Function.prototype.before = function (fn) { let that = this; //this指向调用者fun return function () { fn(); that(...arguments); //es6的展开运算符 } } let newFn = fun.before(function () { co原创 2020-09-21 16:01:29 · 2066 阅读 · 0 评论