Ram*_* KS 2 javascript arrays object reactjs react-props
我试图循环这些数组,但收到此错误“严格模式下不允许旧八进制文字”
const myList =[
{
id: 01,
title: 'FrontEnd Engineer',
name : 'Sheshathri',
describtion: "simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book"
},
{
id: 02,
title: 'QA Engineer',
name : 'Jobin',
describtion: "It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
}
]
export default myList;Run Code Online (Sandbox Code Playgroud)
在 App.js 中
import myList from './ContentList';
const listItem = myList.map(list => <Content key= {list.id} title = {list.title} name = {list.name} describtion = {list.describtion} />);Run Code Online (Sandbox Code Playgroud)
我试图循环这些数组,但收到此错误“严格模式下不允许旧八进制文字”
它指的是你的 id:
id: 01,
title: 'FrontEnd Engineer',
Run Code Online (Sandbox Code Playgroud)
用。。。来代替
id: 1,
title: 'FrontEnd Engineer',
Run Code Online (Sandbox Code Playgroud)
八进制文字是以前导零开头的数字,例如:
变量编号 = 071; // 57
用于标识八进制文字的前导零一直是 JavaScript 中混乱和错误的根源。ECMAScript 5 不赞成在 JavaScript 中使用八进制数字文字,八进制文字在严格模式下会导致语法错误。
八进制