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 摘要。