Why does the console print an object in an array but not an object

This question already has an answer here:

  • Storing Objects in HTML5 localStorage 25 answers

  • 您必须使用JSON stringify存储对象,然后使用parse将其转换回JSON对象。

    localStorage.setItem('allItems', JSON.stringify(allItems));
    var storageItems = JSON.parse(localStorage.getItem('allItems'));
    console.log(storageItems.Items[1].Name);
    
    链接地址: http://www.djcxy.com/p/27948.html

    上一篇: 使用localStorage来存储数字

    下一篇: 为什么控制台打印数组中的对象而不是对象