I'm trying to learn javascript and I'm trying to figure out local storage for a project. But first I believe I need to programmatically build the keys from my Team constructor.
var Team = function(team, manager, cell, add1, add2, city, st, zip, sponsor) {
this.team = team;
this.manager = manager;
this.cell = cell;
this.add1 = add1;
this.add2 = add2;
this.city = city;
this.st = st;
this.zip = zip;
this.sponsor = sponsor;
};
This is from a form I've built and now I want to build the localstorage. This is my failed attempt:
function saveTeam() {
for (var i = 0; i < Team.length; i++) {
localStorage["league." + i "." + javascriptNameOfProperty ] = $('#'+ javascriptNameOfPropertyName + ').val() };
Or something like that. I've tried "property", "key" and others I've tried don't work for the javascriptNameofProperty. Of course, once I get that figured then I've got to figure out localstorage, of course.