In the following example, I would like to access each individual object in the given array. I have tested numerous cases, but still I could able to get the values.
4 Answers
You can only use the dot to access a property value when the property name is an IdentifierName:
Properties are accessed by name, using either the dot notation:
MemberExpression . IdentifierName CallExpression . IdentifierName
or the bracket notation:
MemberExpression [ Expression ] CallExpression [ Expression ]
But IdentifierNames can't begin with a digit:
7.6 Identifier Names and Identifiers
IdentifierName :: IdentifierStart IdentifierName IdentifierPart IdentifierStart :: UnicodeLetter $ _ \ UnicodeEscapeSequence UnicodeLetter :: any character in the Unicode categories “Uppercase letter (Lu)”, “Lowercase letter (Ll)”, “Titlecase letter (Lt)”, “Modifier letter (Lm)”, “Other letter (Lo)”, or “Letter number (Nl)”.
Therefore, you should use the bracket []
notation:
self.dataSeries[0].data[0][0]
Moreover, data[0,1]
may not be what you think. The comma operator evaluates both 0
and 1
expressions, and returns the result of the second one:
The production Expression : Expression
,
AssignmentExpression is evaluated as follows:
Therefore, data[0,1]
is exactly the same as data[1]
.

- 274,082
- 63
- 437
- 513
self.dataSeries[0].data[0][0]
Your first attempt was close, but you can't access array indexes with the dot notation, and must use the array notation

- 4,762
- 2
- 19
- 37
You need to access 0, 450 and 450? Cant you just do self.dataSeries[0].data[0][1]
?

- 233,700
- 52
- 457
- 497

- 1,484
- 16
- 15
You can access your data like this
self.dataSeries[0].data[0][0]
Pattern is
self.dataSeries[parentIndex].data[childIndex][grandChildIndex]

- 25,137
- 8
- 58
- 80
-
any idea of the following question http://stackoverflow.com/questions/30146828/tooltip-kendoui – casillas May 10 '15 at 02:42