One of the first results from a Google search says that this syntax is to be used for localStorage:
localStorage.lastname="Smith";
MDN uses .setItem() and .getItem(), I suppose so that if the browser doesn't support localStorage, then you can add it using the technique defined there.
But since my program is only running on iOS, I guess my question is:
Is it ok to use
localStorage.lastname="Smith";
instead of:
window.localStorage.setItem("lastname","Smith");