search

Home  >  Q&A  >  body text

ES6 Set() usage issues

How to save the created Set() in the form of an array to localStorage?

淡淡烟草味淡淡烟草味2817 days ago575

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-18 10:51:19

    let a = new Set([1,2,3]);
    let b = Array.from(a);
    localStorage.setItem("somename",JSON.stringify(b))
    

    reply
    0
  • Cancelreply