let data = [
{name: 'nowcoder1'},
{name: 'nowcoder2'}
],
l=data.length;
const _api = string => {
// 补全代码
const s = string.split("?");
if(s[0] == 'get') {
return data;
} else if(s[0] == "update") {
//[xxx,yyy] [n=x,t=y] [[n,x],[t,y]] [x,y]
const [from,to] = s[1].split("&").map(str => str.split("=").pop());
for(let i = 0; i < l;i++) {
if(data[i].name == from) {
data[i].name = to;
}
}
}
}



京公网安备 11010502036488号