-1

好的,所以我之前提出这个问题的方式一定太复杂了,所以这里是一个简化版本:

我有一个变量等于:

{
  txid: 'f0315ffc38709d70ad5647e22048358dd3745f3ce3874223c80a7c92fab0c8ba',
  version: 1,
  locktime: 0,
  vin: 
   [ { coinbase: '0420e7494d017f062f503253482f',
       sequence: 4294967295 } ],
  vout: [ { value: 50, n: 0, scriptPubKey: [Object] } ],
  blockhash: '00000000b873e79784647a6c82962c70d228557d24a747ea4d1b8bbe878e1206',
  confirmations: 39288,
  time: 1296688928,
  blocktime: 1296688928 }

我想让另一个变量等于:

vout: [ { value: 50, n: 0, scriptPubKey: [Object] } ],

我该怎么做呢?当我尝试:

varible2 = variable1.vout

我收到一条错误消息,说“.vout”未定义

4

1 回答 1

1
var avariable = {/* your object [literal] here */};

var anothervariable = avariable.vout; // or avariable["vout"]

// or did you want the following?

var anothervariable = {
    vout: avariable.vout
};
于 2012-12-04T21:20:17.913 回答