freecodecamp.cn icon indicating copy to clipboard operation
freecodecamp.cn copied to clipboard

写的能通过,但是有一个小疑问

Open yinxiaosi opened this issue 9 years ago • 2 comments

Challenge Condense arrays with reduce has an issue. User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3067.6 Safari/537.36. Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:

var array = [4,5,6,7,8];
//var singleVal = 0;

// 只能在这一行下面写代码

singleVal = array.reduce(function(aa,bb){
  return aa+bb;
});

他案例的函数中那个0是做什么的呢。我不加也是可以通过的

yinxiaosi avatar May 25 '17 03:05 yinxiaosi

@yinxiaosi 下次这样的问题直接在 gitter 问就好了噢。不要在这儿开 issue 了。。 那个是 reduce 的初始值。详情:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce

S1ngS1ng avatar May 25 '17 03:05 S1ngS1ng

谢谢~~ 好的我了解了呢

------------------ 原始邮件 ------------------ 发件人: "Xing Liu";[email protected]; 发送时间: 2017年5月25日(星期四) 中午11:40 收件人: "FreeCodeCampChina/freecodecamp.cn"[email protected]; 抄送: "Good尹"[email protected]; "Mention"[email protected]; 主题: Re: [FreeCodeCampChina/freecodecamp.cn] 写的能通过,但是有一个小疑问 (#295)

@yinxiaosi 下次这样的问题直接在 gitter 问就好了噢。不要在这儿开 issue 了。。 那个是 reduce 的初始值。详情:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

yinxiaosi avatar May 25 '17 03:05 yinxiaosi