In a plugin, is it possible to have a number in a variable name and is it possible to parse json that has a number in the key?
Yes. A variable name cannot begin with a number though. So when you declare it, make sure you use a letter or underscore.
Yes, but if the key starts with a number you’ll have to access it using bracket notation.
var someJson = response.data;
var apple1 = someJson.apple1;//dot notation
var _1apple = someJson["1apple"];//bracket notation
1 Like