- 博客(8)
- 收藏
- 关注
原创 监听 输入汉字时不统计字母数
主要用的是原生的监听。先上图具体实现:html:<input type="text" id="inputlenght" maxlength="10"><p class="lenght">0/10</pjs: var flag = true var inputId = document.getElementById('inputlenght'); var lenght = document.getElementsByClassName('leng
2022-04-17 00:34:36
69
原创 数组的去重的几种方式
1、setconst arr = [1, 2, 2, 3, 4, 5, 6, 4, 5]const res = new Set([...arr])console.log(res)//{1, 2, 3, 4, 5, 6}2、双重for循环 const arr = [1, 2, 2, 3, 4, 5, 6, 4, 5] for (let i = 0; i < arr.length; i++) { for (let j = i + 1; j < arr.length;
2022-04-06 22:13:16
92
原创 es6中常用的语法(2)
1、对象的拓展/* 1、当变量名和属性名一致时,可以简写 */ let foo = { foo } // es6let foo = { foo: foo } // es5/* 2、方法也可以简写 */const a = { method: function() { // es5 return "Hello!"; } method(){ //es6 return "hello" }}/* 拓展运算符(...)*/let {x, y, ...z} = {x:1, y:2,
2022-04-03 10:21:30
1438
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人