How to add item to localstorage in JavaScript

Storage
Last updated Dec 19, 2017
const name = "John";

localStorage.setItem("name", name);