Predict JSON.parse 使用 Nested 数据
预测输出 简单
题目
什么做 这个 code print?
代码
const json = '{"user":{"name":"Grace","skills":["JS","CSS"]}}';
const data = JSON.parse(json);
console.log(data.user.skills[0]);
提示
导航通过 nested 结构步骤通过步骤.
解释
JSON.parse converts the JSON string into a nested JavaScript object. data.user is the inner object, data.user.skills is the array ["JS", "CSS"], and data.user.skills[0] is "JS". The nested structure mirrors the JSON exactly.
相关资源
相关课程
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。