是否可以轻松地替换“ var exampleMap = new Map();” Internet Explorer 8支持的功能?在Chrome中通过测试编写应用程序后,我意识到它不受支持。
我能想到的最好的解决方案是使用[key,[values]],但这似乎效率极低。
function processData(allText) {
var numOfColumns = 5;
var allTextLines = allText.split(/\r\n|\n/);
return allTextLines;
}
function parseArray(data) {
var allText = processData(data);
var systemApplication = new Map();
for (var i = 1; i < allText.length; i++) {
currentApplicationParameters = allText[i].split(",");
currentApplicationName = currentApplicationParameters[0];
var rsamApplicationProperties = function (entitlementName, environmentName, resourceSequence) {
this.entitlementName = entitlementName;
this.environmentName = environmentName;
this.resourceSequence = resourceSequence;
};
if (systemApplication.has(currentApplicationName)) {
var arrayOfAppParams = [];
arrayOfAppParams = [systemApplication.get(currentApplicationName)];
arrayOfAppParams[0].push(new rsamApplicationProperties(
currentApplicationParameters[1], currentApplicationParameters[3], currentApplicationParameters[2]));
var myNewArray = [].concat.apply([], arrayOfAppParams);
systemApplication.set(currentApplicationName, myNewArray);
} else {
arrayOfAppParams = [new rsamApplicationProperties(currentApplicationParameters[1], currentApplicationParameters[3], currentApplicationParameters[2])];
systemApplication.set(currentApplicationName, arrayOfAppParams);
}
}