var 张三 = {
name: '张三',
age: 18,
gender: true,
height: 1.75,
scores: 59,
grade: null,
skills: ['html', 'css', 'js', 'ps','ae']
};
function uper(key, value) {
if (typeof value == 'string') {
return value.toUpperCase();
}
return value;
}
console.log(JSON.stringify(张三,uper,' '));
以上结果为:
{
"name": "张三",
"age": 18,
"gender": true,
"height": 1.75,
"scores": 59,
"grade": null,
"skills": [
"HTML",
"CSS",
"JS",
"PS",
"AE"
]
}