Bits from Robs 3/15 section

by Lucille Kenney

JavaScript

// Array to hold User Objects

users = [];

function user(contactName, contactTitle, contactID) {
    This.contactName = contactName;
    this.contactTitle;
...
}

// add users to the array
users.push(new User("John Harvard", "Manager", 123));

// print the users to the console

// convert user OBJECT to a String



// check for contats in local storage
var persistedUsers = window.localStorage.getItem('users');
if (persistedUsers != undefined) {
    persistedUsers = JSON.parse(persistedUsers);
    ...
    
    // load users from local storage into Array (as objects)
    persistedsers.forEach(function(u) {
        users.push(new User(u.contactName, u.contactTitle, u.contactID));