why this || symbol used here? what happens to notes please explain
var notes = JSON.parse(localStorage.getItem("notes")) ||
{"shopping list": ""};
why this || symbol used here? what happens to notes please explain
var notes = JSON.parse(localStorage.getItem("notes")) ||
{"shopping list": ""};
It defines a default value to notes. In other word we could say "Notes is {"shopping list": ""} if Json.parse is null"
Take a look at the accepted answer of this thread.
Hope it may helps you