code: function(key, val, expiration)
          {
              // special case - make sure not undefined, because it would just write "undefined" and crash on reading.
              if (val === undefined) {
                  throw new Error("Cannot set undefined value as JSON!");
              }
  
              // set stringified value
              return this.setItem(key, JSON.stringify(val), expiration);
          }
docs: Set a json serializable value. This basically calls JSON.stringify on 'val' before setting it.
  @param key: Item key to set (string).
  @param value: Value to store (object, will be stringified).
  @param expiration: Expiration time, in seconds. If not provided, will not set expiration time.
  @param return: Storage.setItem() return code.