0

why this || symbol used here? what happens to notes please explain

      var notes = JSON.parse(localStorage.getItem("notes")) ||  

              {"shopping list": ""};  

1 Answers1

0

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

Community
  • 1
  • 1
DFayet
  • 881
  • 1
  • 11
  • 21