摘要:
function clearNoNum(value) { //先把非数字的都替换掉,除了数字和. value = value.replace(/[^\d.]/g, '') //保证只有出现一个.而没有多个. value = value.replace(/\.{2,}/g, '.') //必须保证第一 阅读全文
摘要:
var str1 = str.replace(/\\/g,"/"); 阅读全文
摘要:
newArr[2].substring(2,5).replace(/\b(0+)/gi,"") 阅读全文
摘要:
数组:arr:[ {"aa":[{"num":"23"}]}, {"bb":[{"num":"43"}]}, {"cc":[{"num":"42"}]}, ] arr.forEach((value,i)=>{ //数组循环 for(var pl in value){ //数组对象遍历 console 阅读全文
摘要:
//定义一个比较器 compare(propertyName) { return function(object1, object2) { var value1 = object1[propertyName] var value2 = object2[propertyName] if (value2 阅读全文
摘要:
const fs = require('fs'); const result = []; for(let i=0;i<9000;i++){ result.push({ name:i }); } fs.writeFile('./data.json',JSON.stringify(result),(e, 阅读全文
摘要:
1:var json = JSON.parse(str);//注意:属性和属性值都用双引号引住(使用单引号来套双引号,如果反过来写报错) 2:var json = eval("(" + str + ")"); 3:var json = (new Function("return " + str))( 阅读全文
摘要:
Request Payload:Content-Type不为application/x-www-form-urlencoded的请求,只要是Request Payload类型的参数,后台的数据都需要我们自己处理,tomcat并不会处理。Form Data:Content-Type为applicati 阅读全文
摘要:
可以用<label></label>标签的for 属性 + :checked 做,纯CSS <!-- HTML --> <div class="radio-beauty-container"> <label> <span class="radio-name">radio1</span> <input 阅读全文
摘要:
var arr = ["1122","2233","3344"] var newArr = [ {id:"1122",name:"Wang"}, {id:"11",name:"Zhang"}, {id:"2233",name:"Shen"}, {id:"3344",name:"EER"}, {id: 阅读全文