Skip to main content
2 of 3
added 237 characters in body
cabeer
  • 105
  • 7

Accessing values inside a returned array

I am working with truffle and failing to get the actual values from my return:

[ [ { [String: '10'] s: 1, e: 1, c: [Object] },
    { [String: '35'] s: 1, e: 1, c: [Object] },
    { [String: '40'] s: 1, e: 1, c: [Object] },
    { [String: '50'] s: 1, e: 1, c: [Object] },
    { [String: '60'] s: 1, e: 1, c: [Object] } ],
  [ { [String: '20'] s: 1, e: 1, c: [Object] },
    { [String: '35'] s: 1, e: 1, c: [Object] },
    { [String: '40'] s: 1, e: 1, c: [Object] },
    { [String: '50'] s: 1, e: 1, c: [Object] },
    { [String: '60'] s: 1, e: 1, c: [Object] } ] ]

I tried result.valueOf()[0][0].toString() but that didn't do the trick.

However, result.valueOf()[0].toString() is working on the following example:

[ [ { [String: '10'] s: 1, e: 1, c: [Object] } ],
  [ { [String: '20'] s: 1, e: 1, c: [Object] } ] ]

Any help would be appreciated!

EDIT: The goal is to use the values for a test, ideally somehow like that:

 assert.equal(result.valueOf()[0][0].toString(), [10, 35, 40, 50, 60]);
 assert.equal(result.valueOf()[1][0].toString(), [20, 35, 40, 50, 60]);

Cheers! carbee

cabeer
  • 105
  • 7