上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 30 下一页
摘要: Array.prototype.join() 将数组转换为字符串,不会改变原数组 无参情况(默认用逗号分隔) let arr=['jack','tom','mary'] console.log(arr.join()); //jack,tom,mary 有参情况 let arr=['jack','to 阅读全文
posted @ 2022-06-04 15:17 朱在春 阅读(24) 评论(0) 推荐(0) 编辑
摘要: NodeJS内置模块之fs模块 读取文件 const fs = require('fs') fs.readFile('../为学.txt','utf-8',function (err, dataStr) { if (err){ console.log(err.message); }else { co 阅读全文
posted @ 2022-06-04 15:09 朱在春 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 细讲Proxy数据劫持 Vue3中用的就是它 废话不多说,直接上需求 参数targetObj是要劫持的对象,propertyName是对象的属性名 let book = { name: 'es6基础系列' } let proxy = new Proxy(book, { get(targetObj, 阅读全文
posted @ 2022-06-04 14:41 朱在春 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 防抖和节流 什么是防抖?https://www.lodashjs.com/docs/lodash.debounce 前面所有的触发都被取消,只有最后一次的触发在规定时间之后才会触发回调。简单来讲,就是在快速触发的情况下,只会触发最后一次 应用场景:百度搜索 详解如下: ​ 假如在页面有一个输入框in 阅读全文
posted @ 2022-06-04 12:19 朱在春 阅读(20) 评论(0) 推荐(0) 编辑
摘要: JavaScript中字符串转数字 在NodeJS中,字符串的颜色就是普通的白色,数字是黄色。在浏览器中数字是蓝色 任何数据类型与字符串相加都会被转换为字符串,包括null console.log(typeof (null + 'asd')); //string 字符串转数字最快写法、此外还有 Nn 阅读全文
posted @ 2022-06-04 11:31 朱在春 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 如何使用Swiper 俗称:轮播图 官方文档:https://www.swiper.com.cn/usage/index.html 在静态页面中使用 引入swiper.min.css 设置宽度(Swiper6之前是.swiper-container,Swiper7是.swiper,就是指下面那个最大 阅读全文
posted @ 2022-06-04 11:01 朱在春 阅读(395) 评论(0) 推荐(0) 编辑
摘要: Array.prototype.sort() 返回值:排序后的数组 无参情况 let one = ['FBI', 'abc', 'cba', 'NBA'] console.log(one.sort()); // ['FBI', 'NBA', 'abc', 'cba'] // 无参:按照 Unicod 阅读全文
posted @ 2022-06-03 22:03 朱在春 阅读(42) 评论(0) 推荐(0) 编辑
摘要: Array.prototype.reduce() 做统计用的,不会改变原数组 参数:每一次的返回值将作为下一次pre的初始值,pre可以设置默认值,cur是当前项 不要小瞧了下面这些代码,你不一定会写 求和 console.log([1, 2, 3, 4].reduce((pre, cur) => 阅读全文
posted @ 2022-06-03 20:42 朱在春 阅读(24) 评论(0) 推荐(0) 编辑
摘要: Object.getOwnPropertyNames() 返回自身所有的属性名(包括不可枚举的,但不包括Symbol值作为名称的属性)组成的一个数组 阅读全文
posted @ 2022-06-03 16:28 朱在春 阅读(61) 评论(0) 推荐(0) 编辑
摘要: Array.prototype.concat() 用于合并多个数组,不会改变原有数组。浅拷贝 它的本质是卸掉一层中括号,然后再合并到一起。注意,只是一层 let a=[1,2] let b=[3,[4]] console.log(a.concat(b)); //[ 1, 2, 3, [ 4 ] ] 阅读全文
posted @ 2022-06-02 20:33 朱在春 阅读(60) 评论(0) 推荐(0) 编辑
上一页 1 ··· 20 21 22 23 24 25 26 27 28 ··· 30 下一页