js
迷之珊瑚
这个作者很懒,什么都没留下…
展开
-
《javascript 设计模式与开发实践》笔记
惰性单例原创 2022-12-05 22:47:35 · 157 阅读 · 1 评论 -
个人事务管理系统
个人事务管理系统原创 2022-09-20 17:52:59 · 243 阅读 · 0 评论 -
精通javascript -——笔记
精通javascript -——笔记原创 2022-09-08 17:12:41 · 216 阅读 · 0 评论 -
《javascript忍者秘籍》笔记
《javascript忍者秘籍》笔记原创 2022-08-03 18:18:43 · 309 阅读 · 0 评论 -
你不知道的javascript
第二部分 this和对象原型this 并不像我们所想的那样指向函数本身。function foo(num){ console.log("foo:"+num); this.count ++}foo.count =0var i;for(var i=0;i<10;i++){ if(i<5){ foo(i) }}console.log(foo.count);// foo: 6// foo: 7// foo: 8// foo:原创 2022-04-19 17:43:57 · 900 阅读 · 0 评论 -
如何使用apiDoc
最近对后端同学的接口文档很感兴趣,抽空学习了下~1、安装nodeJs2、安装和使用apiDoc 新建一个文件夹,打开终端:npm install apidoc -g把api注释写在你要调用的接口上方具体含义参考官网:https://apidocjs.com/#param-api-sample-request@api@api {method} path [title]接口方法、路径和名称@apiGroup@apiGroup nam...原创 2021-03-24 10:48:03 · 511 阅读 · 0 评论 -
javascript之reduce()方法的使用
// 案例1:数组去重 var arr = [12, 34, 34, 342, 345, 34, 123, 345, 45, 12] var newArr= arr.reduce(function(prev,next){ prev.indexOf(next) == -1 && prev.push(next) return prev },[]) console.log(newArr) // 案例2:数组中元素求和 va.转载 2021-01-28 15:37:02 · 122 阅读 · 0 评论 -
js中函数声明提前
1、通过varfn=function(){}定义函数,只是将函数名提前了,函数体没有提前,如果在函数体前使用fn()调用函数就会报错 fn() var fn = function(){ console.log("函数声明没有提前") }2、通过functionfn(){}定义函数,是将整个函数体提前了,此时使用fn()调用函数就会正常 fn() function fn(){ console.log("函数体提前") }...转载 2021-01-19 11:50:40 · 289 阅读 · 0 评论 -
js实现一个map
Array.prototype.map2 = function (callback){ for(var i=0;i<this.length;i++){ callback(i,this[i]) } } var arr = [1,2,55,4,5,6,7,8] arr.map2((index,item)=>{ console.log(index,item) })转载 2021-01-18 17:01:38 · 189 阅读 · 0 评论 -
Promise初步详解
//resolve的用法var p = new Promise(function(resolve,reject){ var timer = setTimeout(function(){ console.log("执行操作1") resolve("这是数据1") },1000) }) p.then(function(data){ console.log(data) console.log("这是成功操作").转载 2020-12-25 10:09:59 · 76 阅读 · 0 评论 -
请用 JS 写出一个遍历 DOM 节点树的方法
<section class="container"> <div class="left"> <div class="menu"></div> </div> <div class="right"> <div class="box1"></div> <div class="box2"></div>.转载 2020-12-17 12:01:30 · 196 阅读 · 0 评论 -
JS原型链继承
function Main(){ } Main.prototype.sex ="男" Main.prototype.eat = function(){ console.log("Main eat..") } function Person(){} // 先继承 Person.prototype = new Main() Person.prototype.constructor = Person; //后定义属性和方.转载 2020-12-17 10:53:28 · 68 阅读 · 0 评论