Adding JavaScript and Services to Write to LocalStorage

Writing JavaScript to access localStorage

We need to write the JavaScript functions that will read to and write from the browser’s localStorage. We do this as follows:

  1. Right-click the wwwroot folder and select the “Add, New Folder” option from the menu.
  2. Name the new folder scripts.
  3. Right-click the scripts folder and select the “Add, New Item” option from the menu.
  4. Enter “javascript” in the “Search” box.
  5. Select “JavaScript File.”
  6. Name the file bweInterop.js.
  7. Click the “Add” button.
  8. Enter the following JavaScript:

Get hands-on with 1200+ tech skills courses.