Quiz
- Can you explain number 4?
Sure. Here is it:
Our LocalStore class for CoffeeRun differs from the DataStore class by (check all that apply) A. arguments to the constructor B. implementation for the constructor C. arguments and return values for methods D. implementation for the methods
All but C change. The best way to see that is to do a side-by-side-comparison:
DataStore and LocalStore.
- Can we go over JSON.parse() and JSON.stringify()? I don't feel like I fully understand their uses.
Sure. Let's go back to the JSON part of the reading.
- can you elaborate on the impact between servers? Like how and why
we might interfere with the variables of another website?
Suppose I have high scores on one page
and coffee orders on another pagehttps://cs.wellesley.edu/~anderson/myscores.html
, but those pages have the same origin, clearing the localstorage for that origin affects both.https://cs.wellesley.edu/~cs204/coffeerun/basic-ls/
Better to just remove the key/value pairs used in that app.
- How are LocalStorage and a browser's cache different? They seem to be very similar concepts.
Interesting question! Yes, they are similar, in that they can persist across browser sessions and are saved to the local filesystem.
However, we have little control over the cache from JavaScript. We can't take anything out, or look anything up. So, in terms of the functionality for our web apps, they are very different.
- Nominations: DataStore; DataLocalStore
Good ones! On Thursday, we'll be looking at
RemoteDataStore
, so maybeLocalDataStore
?