JSON取值(key是中文或者數字)方式詳解

  先準備一個json對象用於演示json var json = {'name':'zhangsan', '年齡':23, 404:'你可能迷路了'}; 一、使用JS中with關鍵字數組 with(json) { console.log(name);//輸出:zhangsan console.log(年齡);//輸出:23 console.log(404);//輸出:404
相關文章
相關標籤/搜索