feat: 初始化

This commit is contained in:
杭城小刘
2018-09-11 10:11:39 +08:00
committed by 杭城小刘
commit 8e5d2c9e7f
264 changed files with 12082 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
* 将json转换为对象JSON.parse\(\)函数的第二个参数用来转换解析出的属性
```
JSON.parse('{"name":"lbp","age":"20"}',function(key,value){
if(key == "name"){
return value + "同学";
}
return value;
});
```
* 将对象转换为jsonJSON.stringify\(\)函数的第二个参数用来筛选对象的键值
```
var student = {"name":"小米","age":22,"height":177,"skills":["js","oc"]};
function convert(key,value){
if (typeof value === "string") {
return value.toString().toUpperCase();
}
return value;
}
JSON.stringify(student,convert,' ');
```