摘要: var n=0.0145; n.toFixed(2);//保留两位小数 n.lastIndexOf('a');//检索字符串最后出现的位置 n.indexof("h");//检索字符串出现的位置 n.length;//显示字符长度 n.slice(1,3);//字符串截取 n.substr(star 阅读全文
posted @ 2016-06-08 11:39 二年后的今天 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 通常来讲,使用 instanceof 就是判断一个实例是否属于某种类型。例如: var oStringObject = new String("hello world"); console.log(oStringObject instanceof String); 后面string 可以是numbe 阅读全文
posted @ 2016-06-08 10:56 二年后的今天 阅读(112) 评论(0) 推荐(0) 编辑
摘要: var obj={0:1,1:'id'};//访问对象 obj['0'];//用[]来访问,不要用.的方式访问 对象与字符串的转换 node.js JS对象和JSON字符串之间的转换 JSON.stringify(obj)将JS对象转为字符串。 var json = { aa: ['sdddssd' 阅读全文
posted @ 2016-06-08 10:36 二年后的今天 阅读(997) 评论(0) 推荐(0) 编辑