随笔分类 -  JS

摘要:需求: 有字符串"name:lxh;job:developer;",希望转成[{name:'lxh'},job:'developer'}]形式 实现: var test = "name:lxh;job:developer;";// 测试串 var out = [];// 需要输出的结果 var te 阅读全文
posted @ 2021-02-09 15:24 lvlin241 阅读(228) 评论(0) 推荐(0) 编辑
摘要:参考 yourArr=JSON.parse(JSON.stringify(yourArr)) 阅读全文
posted @ 2020-08-21 16:07 lvlin241 阅读(3538) 评论(0) 推荐(0) 编辑
摘要:// 待转换为数组的字符串 var a = "aa,bb,cc,dd," // 分割为数组 var b = a.split(",") 输出结果:["aa", "bb", "cc", "dd", ""] // 排除b数组中的空元素 var c = b.filter(str=>{return !!str 阅读全文
posted @ 2020-06-22 17:12 lvlin241 阅读(2612) 评论(0) 推荐(0) 编辑
摘要:1. text-overflow 2. white-space text-overflow: ellipsis; //溢出用省略号显示 white-space: nowrap; //溢出不换行 阅读全文
posted @ 2020-06-09 20:41 lvlin241 阅读(794) 评论(0) 推荐(0) 编辑
摘要:Lodash 阅读全文
posted @ 2020-06-02 14:16 lvlin241 阅读(419) 评论(0) 推荐(0) 编辑
摘要:1. 已知对象去除固定的key及其对应的value 例:将下面obj对象中的name去掉 var obj = {'name':'lxh','hobby':'running','address':'software park'} 命令 delete obj['name'] 阅读全文
posted @ 2020-05-29 19:39 lvlin241 阅读(272) 评论(0) 推荐(0) 编辑
摘要:1. 问题描述 <1> 问题:从SVN上down下来的VUE项目,本地webstorm启动出现以下问题 原因分析:webstorm自动使用npm install命令运行,但是node_modules里面有未安装的依赖,需要忽略该依赖; 解决方案: <1> 删除项目根路径下的 node_modules 阅读全文
posted @ 2020-04-29 18:18 lvlin241 阅读(130) 评论(0) 推荐(0) 编辑
摘要:参考 function func(){console.log("print")} //定时任务 var interval = setInterval(func, 2000); //启动,func不能使用括号 clearInterval(interval );//停止 interval = setIn 阅读全文
posted @ 2020-04-24 21:50 lvlin241 阅读(141) 评论(0) 推荐(0) 编辑
摘要:1. String >Object // 待转化字符串 var str = '{"name":"lxh","add":"China"}'; // 字符串转化为Object var obj = eval('('+str+')'); // 判断obj类型 typeof(obj) // 获取转换后的对象 阅读全文
posted @ 2020-04-16 21:37 lvlin241 阅读(15554) 评论(0) 推荐(1) 编辑
摘要:js专题 阅读全文
posted @ 2020-02-04 22:05 lvlin241 阅读(62) 评论(0) 推荐(0) 编辑
摘要:https://supert.club:315/ 可随机生成:身份证号码,营业执照注册号,组织机构代码,统一社会信用代码,手机号码,银行卡账号等 阅读全文
posted @ 2019-09-04 17:24 lvlin241 阅读(2001) 评论(0) 推荐(0) 编辑
摘要:// 检索(字符串中判断是否包含某个字符) 字符串.search('检索的内容');// 返回-1,不包含; 返回非-1,包含 字符串.indexOf("待判断的内容"); // 截取 字符串.substr(起始位置,长度); 字符串.substring(起始位置,长度); 示例: var a = "as far as i known, xxx is handsome"; b = a.sub... 阅读全文
posted @ 2019-01-22 12:09 lvlin241 阅读(3782) 评论(0) 推荐(0) 编辑
摘要:var a = 2.34567; var b = a.toFixed(3); // 输出结果:2.346 // 数字字符串转换为数字 var c = "123"; typeof c; // string var d = parseInt(c); typeof d; // number var e = parseInt(c); typeof e; // number 阅读全文
posted @ 2018-11-26 20:17 lvlin241 阅读(297) 评论(0) 推荐(0) 编辑
摘要:解决方法如下: 1、在Firefox浏览器的地址栏中输入about:config,即打开Firefox的配置页面 2、然后搜索dom.allow_scripts_to_close_windows,找到后你会发现该配置的默认值是false,右键选择Toggle选项,选择切换,将值修改为true即可. 阅读全文
posted @ 2018-09-29 13:39 lvlin241 阅读(296) 评论(0) 推荐(0) 编辑
摘要:1、通过URL传递并接受 阅读全文
posted @ 2018-09-28 17:56 lvlin241 阅读(123) 评论(0) 推荐(0) 编辑
摘要:参考:https://blog.csdn.net/qq_27446553/article/details/52433375 1、a href="_blank" 添加属性 rel="noreferrer" 2、window.ope var newWindow = window.open("跳转链接") 阅读全文
posted @ 2018-09-12 14:07 lvlin241 阅读(1247) 评论(0) 推荐(0) 编辑
摘要:思路:把对象转换为字符串进行传递 参考:https://blog.csdn.net/shuai870081885/article/details/51283390 阅读全文
posted @ 2018-09-06 11:41 lvlin241 阅读(1087) 评论(0) 推荐(0) 编辑
摘要:/** * 时间戳转换为日期 */ function convertTimestamp(timestamp){ // 时间戳转换为日期 var d = new Date(timestamp); // 日期按指定格式输出(例如: 2018-09-03 17:09:45) var year = date.getFullYear(); var month = ... 阅读全文
posted @ 2018-09-03 17:45 lvlin241 阅读(459) 评论(0) 推荐(0) 编辑
摘要:https://blog.csdn.net/young_gao/article/details/78341317 阅读全文
posted @ 2018-07-15 13:12 lvlin241 阅读(136) 评论(0) 推荐(0) 编辑
摘要:$("#selectId")[0][0].selected = true; 阅读全文
posted @ 2018-07-15 13:11 lvlin241 阅读(967) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示