console.log(parseFloat(parseFloat("3.1415926").toFixed(2)));//3.14
console.log(parseFloat(parseFloat("3.1000001").toFixed(2)));//3.1
parseFloat(123456789.123456.toFixed(2)).toLocaleString(); //"123,456,789.12"(注意输出的是字符串)parseFloat(parseFloat("123456789.123456").toFixed(2)).toLocaleString(); //转换字符串格式...
$.ajax({type: "POST",url: "http://127.0.0.1:9999/api/demo/CURD",data: JSON.stringify({token: "sgToken",jsonPath: "user",username: "测试账号",password: "123456",name:...
var a = {a: 1}; var b = {b: 2}; var c = Object.assign(a, b);/* a对象也会改变,b不变,返回被被修改对象 */ var d = Object.assign({}, a, b); /* a,b不会被改变,返回新的对象 */ console.log("a", a); cons...
function regText(text){var reg = /^[su4e00-u9fa5a-z0-9_-]{0,}$/;if(!reg.exec(text)){console.log("非法字符")}else{console.log("有效字符")} } regText("abc+") 验证 :汉字、英文、数字、下...