- 博客(5)
- 收藏
- 关注
原创 Array常用方法(数组增加、数组删除、数组截取、数组查找、数组遍历)
Array的常用方法使用1.数组增加push: 向数组的末尾添加新的元素(参数可以是多个),返回数组长度,改变原数组var arr = [];var arrLength = arr.push('1');console.log(arrLength); // 1arrLength = arr.push('2','3','4');console.log(arrLength); // 4console.log(arr); // ['1','2','3','4']unshift: 向数组的开头添加
2021-11-08 07:21:46
3124
原创 react-router多级路由设置默认子路由
react-router多级路由设置默认子路由最终效果图目录文件路径代码最终效果图目录文件路径代码src/App.js多级路由的Route配置不能加 exact, 否则子路由匹配不进去import React from 'react';import { BrowserRouter as Router, Route, Link } from 'react-router-dom'import Home from './Page/Home'import News from './Page/N
2021-10-10 09:45:05
3313
原创 Server is started at 5500 but failed to open in Browser Preview
VScode中使用Open with Live Server打开html文件,会出现“Server is started at 5500 but failed to open in Browser Preview. Got Browser Preview extension installed?”如下错误。解决办法1.打开Setting页面2.将User Browser Preview前...
2020-03-29 18:27:02
15690
8
原创 JS原生代码封装数组去重
1.数组原生链上数组去重Array.prototype.unique = function (){ var map = {}, arr = [], len = this.length; for(var i = 0 ; i < len ; i ++ ) { if(!map[this[i]]) { map[this[i]] =...
2020-03-15 11:57:57
206
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人