随笔分类 -  javascript

摘要:###工厂模式 function createPerson(name, age, job) { let o = new Object(); o.name = name; o.age = age; o.job = job; o.sayName = function() { console.log(th 阅读全文
posted @ 2023-03-09 19:37 zeal666 阅读(16) 评论(0) 推荐(0) 编辑
摘要:/** * 每个csv文件转成一个person对象,然后根据父子关系构建树 */ const transferTree = () => { interface Person { name: string age: number parent: string | null children?: Per 阅读全文
posted @ 2023-03-09 13:45 zeal666 阅读(79) 评论(0) 推荐(0) 编辑
摘要:You can use the following code to detect the different browsers: // Check for Chrome var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/ 阅读全文
posted @ 2023-03-01 15:16 zeal666 阅读(21) 评论(0) 推荐(0) 编辑
摘要:const equals = (a,b) =>{ if(a b) return true; if(a instanceof Date && b instanceof Date){ return a.getTime() b.getTime() } if(!a || !b || (typeof a != 阅读全文
posted @ 2023-02-21 17:13 zeal666 阅读(156) 评论(0) 推荐(0) 编辑
摘要:本篇文章主要是看了下面这篇博文和知乎上的讨论出现的 http://www.cielni.com/2020/01/10/java-date-format/#more https://zhuanlan.zhihu.com/p/100648038 通常前端会使用dayjs().format()来进行格式化 阅读全文
posted @ 2023-01-18 14:02 zeal666 阅读(1130) 评论(0) 推荐(0) 编辑
摘要:原文地址:http://zoo.zhengcaiyun.cn/blog/article/code-shape undefined和null不同的原因 undefined是栈空间中表示未定义含义的一块特殊的固定的内存区域 null是堆内存空间中的具有固定内存地址且唯一存在的一个内置对象 2.变量栈 堆 阅读全文
posted @ 2022-12-14 16:56 zeal666 阅读(10) 评论(0) 推荐(0) 编辑
摘要:function Person(name){ this.name = name } let person = new Person('xiaoming') person.__proto__ Person.prototype 对象的__proto__ 构造函数的prototype Person.__p 阅读全文
posted @ 2022-05-17 15:53 zeal666 阅读(19) 评论(0) 推荐(0) 编辑
摘要:下列代码存在几个变量没有被回收? var i = 1;var i = 2; var add = function() { var i = 0; return function(){ i++; console.log(i); }}();add(); 有3个变量没有被回收,首先是全局变量中的i,第二个v 阅读全文
posted @ 2021-01-26 16:05 zeal666 阅读(93) 评论(0) 推荐(0) 编辑
摘要:转载地址:https://www.cnblogs.com/cosiray/p/4512969.html javascript中apply、call和bind的区别 在JS中,这三者都是用来改变函数的this对象的指向的,他们有什么样的区别呢。在说区别之前还是先总结一下三者的相似之处:1、都是用来改变 阅读全文
posted @ 2020-12-06 17:04 zeal666 阅读(62) 评论(0) 推荐(0) 编辑
摘要:已知函数 fn 执行需要 3 个参数。请实现函数 partial,调用之后满足如下条件:1、返回一个函数 result,该函数接受一个参数2、执行 result(str3) ,返回的结果与 fn(str1, str2, str3) 一致 输入: var sayIt = function(greeti 阅读全文
posted @ 2020-11-21 12:14 zeal666 阅读(288) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示