How do I find an existing declared array or variable after I get the value of a data attribute?
For example
var myArray = [{a: 50, b: 70}, {a: 80, b: 90}],
mySecondArray = [{a: 30, b: 20}, {a: 80, b: 40}];
$('.button').click(function() {
var newArray = $(this).data('value'); // this will be a string depending on the value of any .button i clicked on <div data-value='myArray'></div>
doSomething(newArray);
};
How do I use HTML 5 attribute to find an existing array and do something to it?