![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
js小技巧
几何幸运
这个作者很懒,什么都没留下…
展开
-
数组遍历取第一条数据
this.plans = [ { id: 0, name: '小明', age: 15 }, { id: 1, name: '小花', age: 20 }, { id: 2, name: '小天', age: 19 } ] const [a, .原创 2021-02-02 17:08:05 · 1835 阅读 · 0 评论 -
非常规数组转化
const area = ['0点,1点']; console.log(area[0]) const a = JSON.stringify(area[0]) const b = a.substring(1, a.length - 1) const c = b.split(',') console.log(c)原创 2021-01-28 09:48:39 · 124 阅读 · 0 评论 -
常用的JavaScript技巧
// 1.声明变量// Longhandlet x;let y = 20;//Shorthandlet x, y = 20;// 2.给多个变量赋值// (使用数组解构来在一行中给多个变量赋值。)// Longhandlet a, b, c;a = 5;b = 6;c = 12;// Shorthandlet [a, b, c] = [5, 6, 12]// 3.三元运算符// Longhandlet marks = 26;let result;if (marks原创 2021-01-20 14:24:42 · 132 阅读 · 2 评论