Tell us what’s happening:
hi guys , could help me plzzzz
Your code so far
var array = [4,5,6,7,8];
var singleVal = 0;
// Only change code below this line.
singleVal = array;
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.
Link to the challenge:
https://www.freecodecamp.org/challenges/condense-arrays-with-reduce
What is your question? what have you tried?
To be honest , I tried several times to understand the concept , but the effort seems to have gone in vain
this my trial
could u help me please ?
var array = [4,5,6,7,8];
var singleVal = 0;
// Only change code below this line.
var singleVal = array.reduce(function(previousVal, currentVal) {
return previousVal - currentVal;
}, 0)
I don’t know !! I just copy - paste from the example !
Indeed it seems like you just c/p without reading 
From the exemple itself :
Here is an example of reduce being used to subtract all the values of an array
var singleVal = array.reduce(function(previousVal, currentVal) {
return previousVal - currentVal;
}, 0);
Just a spoiler, you already got everything needed to solve this problem
Edit: With your to-be-deleted post you are clearly not seeking to understand but just have the answer. I won’t help you further more here.
Let me tell you that this is my last challenge
JavaScript
I tried repeatedly
If you like the help, welcome, or else leave
- Read the instructions
- Read the instructions
- Read, the, instructions
I won’t give you the damn working code because you don’t want to read
So you are going to answer thoses questions
-
What does x - y do (mathematic field)
-
What does return do
-
What does return x - y do
-
What does substract mean ?
-
What does subtract all the values of an array mean ?