javascript-tutorial / javascript-tutorial/en.javascript.info

Array Task Solution Clarification

未關閉
#2,635 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
HTML
星號
25.5k
分支
4k
PR 合併指標
30 天內沒有已合併 PR

描述

Data Types > Arrays > Tasks > Second Task 'Array operations.'
https://javascript.info/array#tasks

Instruction 3 states:

> "Replace the value in the middle by "Classics". Your code for finding the middle value should work for any arrays with odd length."

This specifies that we should **replace** the middle value, and that our code should work for any arrays with an **odd** length.

The solution provided does not include a condition, and will always replace a value in an array, regardless of it's length.

Consider adding:

`
if (styles.length % 2 !== 0) {
styles[Math.floor(styles.length / 2)] = 'Classics'
}
`

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

開啟連結的 javascript.info Array 任務頁面,並檢查第二個任務「Array operations」及其提供的解決方案。檢查該解決方案是否符合針對奇數長度所述的要求,並如描述般替換中間值。當教學解決方案與針對奇數長度陣列的指示一致時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
javascript
領域
documentation
Issue 類型
文件
難度
1/5
預估耗時
1 小時以內
活躍度
停滯
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。