Monday, June 18, 2018

How do I dot dot dot into things with bracket notation in JavaScript?

You can drill deep into a JSON object like so:

switch(game.board["row" + (xCounter - 1)]["spot" + yCounter]) {

 
 

It's syntactically a bit like having at a multidimensional array in C#.

No comments:

Post a Comment