how to store and extract local storage code example
Example: how to store and extract local storage
let p1 = new Point(1,2);
let p2 = new Point(4,8);
let p3 = new Point(3,7);
// create a polygon using an array containing p1, p2, p3
let poly1 = new Polygon([p1,p2,p3]);
// store in local storage
localStorage.setItem("poly1",JSON.stringify(poly1));
// retrieve into new variable
let poly1Data = JSON.parse(localStorage.getItem("poly1"));