2017-11-04 17 views
0
console.log(a) ; // console window result= 1 
console.log(b);// console window result= 2 

var c = {a : b};// any recommendations here? 
var d = JSON.stringify(c); 
d = encodeURIComponent(d); 

最終結果はd = {1:2}です。JSONで2つのオブジェクトキーを連結

答えて

3

あなたが計算されたプロパティを使用することができます

var c = {[a] : b}; 
関連する問題