我的 javascript 中有一个错误,它说 (e) 未定义

https://img1.sycdn.imooc.com/657aa24a00016d3104630121.jpg

我的代码和图像中的错误


import React from 'react';


const Main = () => {

  const joiningCriteria = [

    'People between the ages of 18 and 35 years.',

    'A demonstrated passion for coding and technology.',

    'The time and capacity to commit to a full coding bootcamp. Classes are three times per week in person at one of our learning hubs.',

    'An intermediate level of English comprehension.',

    'The aptitude to succeed in the selection process.',

  ];

  return (

    <section class="bootcamp">

      <ol>

        {joiningCriteria.map(() => (

          <li>{e}</li> /*the error is here it say the (e) is not defined*/

        ))}

      </ol>

    </section>

  );

};

export default Main;


郎朗坤
浏览 114回答 3
3回答

largeQ

要使地图正常工作,您必须传递一个允许选择每个元素的变量。尝试这个const joiningCriteria = ['People between the ages of 18 and 35 years.','A demonstrated passion for coding and technology.','The time and capacity to commit to a full coding bootcamp. Classes are three times per week in person at one of our learning hubs.','An intermediate level of English comprehension.','The aptitude to succeed in the selection process.',];return (&nbsp; <ol>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; {joiningCriteria.map((e,index)=> {return <li key={index}>{e}</li>} /*the error is here it say the (e) is not defined*/&nbsp; &nbsp; )}&nbsp; </ol>&nbsp;</section>); };

慕桂英4014372

您需要将 e 作为参数添加到地图中。然后,数组中的值将显示为列表元素。&nbsp;&nbsp;<ol>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{joiningCriteria.map((e)=>&nbsp;(<li>{e}</li>))} &nbsp;&nbsp;</ol>

哔哔one

请将(e)添加到地图中,例如从map(()=>到map((e)=>会起作用的谢谢
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript