// 字符串首字母大写 function firstUpperCase(str) { return (str||'').replace(/( |^)[a-z]/g, L => L.toUpperCase()); } {a:{b:1,c:1,n:{n1:8}},c:678,d:999}