亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我的 javascript 中有一個錯誤,它說 (e) 未定義

我的 javascript 中有一個錯誤,它說 (e) 未定義

郎朗坤 2023-12-14 14:35:32
我的代碼和圖像中的錯誤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;
查看完整描述

3 回答

?
largeQ

TA貢獻2039條經驗 獲得超8個贊

要使地圖正常工作,您必須傳遞一個允許選擇每個元素的變量。嘗試這個


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 (


  <ol>        

      {joiningCriteria.map((e,index)=> {return <li key={index}>{e}</li>} /*the error is here it say the (e) is not defined*/

    )}

  </ol>

 

</section>

); };


查看完整回答
反對 回復 2023-12-14
?
慕桂英4014372

TA貢獻1871條經驗 獲得超13個贊

您需要將 e 作為參數添加到地圖中。然后,數組中的值將顯示為列表元素。

  <ol>        
      {joiningCriteria.map((e)=> (<li>{e}</li>))}
  </ol>


查看完整回答
反對 回復 2023-12-14
?
嗶嗶one

TA貢獻1854條經驗 獲得超8個贊

請將(e)添加到地圖中,例如

map(()=>

map((e)=>

會起作用的

謝謝


查看完整回答
反對 回復 2023-12-14
  • 3 回答
  • 0 關注
  • 179 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號