对象数组和JSON
const todos = [
{
id: 1,
text: 'Buy groceries',
iscompleted: true
},
{
id: 2,
text: 'MY Boss',
iscompleted: true
},
{
id: 3,
text: '散会',
iscompleted: true
}
];
console.log(todos[1].text);
const todos = [
{
id: 1,
text: 'Buy groceries',
iscompleted: true
},
{
id: 2,
text: 'MY Boss',
iscompleted: true
},
{
id: 3,
text: '散会',
iscompleted: true
}
];
const todoJSON = JSON.stringify(todos);
console.log(todoJSON);

浙公网安备 33010602011771号