gpt4 book ai didi

javascript - ReactJS 中的 "Legacy octal literals are not allowed in strict mode"是什么意思?

转载 作者:行者123 更新时间:2023-12-05 09:31:48 25 4
gpt4 key购买 nike

我正在尝试遍历这些数组,但收到此错误“严格模式下不允许使用旧版八进制文字”

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;

在 App.js 中

import myList from './ContentList';

const listItem = myList.map(list => <Content key= {list.id} title = {list.title} name = {list.name} describtion = {list.describtion} />);

最佳答案

I am trying to loops through these array's but am getting this error"Legacy octal literals are not allowed in strict mode"

它指的是你的ids:

id: 01,
title: 'FrontEnd Engineer',

替换为

id: 1,
title: 'FrontEnd Engineer',

Octal literals are numerals that begin with a leading zero, such as:

var num = 071; // 57

The leading zero to identify an octal literal has been a source ofconfusion and error in JavaScript. ECMAScript 5 deprecates the use ofoctal numeric literals in JavaScript and octal literals cause syntaxerrors in strict mode.

Octal系统

关于javascript - ReactJS 中的 "Legacy octal literals are not allowed in strict mode"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68604050/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com