一些JavaScript小技巧
实际上是开发微信小程序我踩过的一些坑,也是我的学习笔记,如果你想实现类似的功能,或者遇到类似问题,可以参考这篇文章。 针对多维数组,在原有数据的后面追加数据 知识点:...扩展运算符,用于数组的展开。 **情景:**包含时间、传感器值的二维数据的数组,形如[[11:45:14, 1.23], [11:45:15, 2.33]]。需要在后面插入相同形式的数据。 方法:使用扩展运算符...展开原数组和追加数组,然后合并为新数组。 例子: 123const oldData = res.data || [];const newData = [...oldData, ...removed];wx.setStorageSync(currentDate, newData); Q&A: Q:为什么不能直接写[oldData,...
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick Start Create a new post 1$ hexo new "My New Post" More info: Writing Run server 1$ hexo server More info: Server Generate static files 1$ hexo generate More info: Generating Deploy to remote sites 1$ hexo deploy More info: Deployment
