admin管理员组文章数量:1334797
I am trying to loops through these array's but am getting this error "Legacy octal literals are not allowed in strict mode"
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;
I am trying to loops through these array's but am getting this error "Legacy octal literals are not allowed in strict mode"
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;
In App.js
import myList from './ContentList';
const listItem = myList.map(list => <Content key= {list.id} title = {list.title} name = {list.name} describtion = {list.describtion} />);
Share
Improve this question
edited Jul 31, 2021 at 16:53
Giorgi Moniava
28.7k9 gold badges57 silver badges98 bronze badges
asked Jul 31, 2021 at 16:45
Ramkumar KSRamkumar KS
351 silver badge6 bronze badges
1
- strict mode by default throws error for legacy methods/code, you should avoid legacy code – Amruth Commented Jul 31, 2021 at 16:47
1 Answer
Reset to default 8I am trying to loops through these array's but am getting this error "Legacy octal literals are not allowed in strict mode"
It refers to yours ids:
id: 01,
title: 'FrontEnd Engineer',
Replace with
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 of confusion and error in JavaScript. ECMAScript 5 deprecates the use of octal numeric literals in JavaScript and octal literals cause syntax errors in strict mode.
Octal system
本文标签:
版权声明:本文标题:javascript - what does it mean "Legacy octal literals are not allowed in strict mode" in ReactJS? - Stack Over 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742372505a2462511.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论