I created a function which allows to return an object whose name change to each loop.
I done this function like this :
function createObjPack(index){
var currentPack = packVehicule[key].libelle;
return [eval(currentPack + ' = {}' ), calcul(currentPack, key)];
};
The variable curentPack contains the name of the current object.
The return must generate a object which name match the value of currentPack
I thought read the currentPack directly into an eval() function for change dynamicly the name but, it doesn't work.
Someone can help me ?
evalto create dynamic variable names, just assignwindow[currentPack], since all global variables are properties ofwindow.