<script>
var query = {//数据
fileSize: 1,//文件大小
dataSize: 2,//每片大小
nextOffset: 0//下次偏移
}
var queryStr = Object.getOwnPropertyNames(query).map(key => {
return key + "=" + query[key];
}).join("&");
console.log(queryStr);
//Object.getOwnPropertyNames,返回数组
//map ,按key与值组装数组
//join,用&把数组分割成字符串
</script>
var query = {//数据
fileSize: 1,//文件大小
dataSize: 2,//每片大小
nextOffset: 0//下次偏移
}
var queryStr = Object.getOwnPropertyNames(query).map(key => {
return key + "=" + query[key];
}).join("&");
console.log(queryStr);
//Object.getOwnPropertyNames,返回数组
//map ,按key与值组装数组
//join,用&把数组分割成字符串
</script>