📅  最后修改于: 2022-03-11 15:02:18.150000             🧑  作者: Mango
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"));