all comments

[]x0x7 -0 points

Figured it out. Never mind.

In the first loop it gives the first and second values of the array.

[]jtriangle -0 points

Forgive me for being a noob, I don't know java, but is all of that just to concatenate the two strings? Surely there's an easier way?

[]x0x7 -0 points

It's javascript. Different language.

It's a higher order function to do a lot of different things where you turn an array of values into a single item. Let's say you wanted to multiply a list of things.


function multiplyall(list) {
  return list.reduce((start,item)=>start*item);


function multiplyall(list) {
  var start=1;
  for(var i=0;i<list.length;++i) {
  return start;

It's so small you could do it inline.

console.log(`The rocket went ${[5,6,9,4].reduce((a,b)=>a*b)} feet into the air`);

[]jtriangle -0 points

Aha! I understand.

That's pretty wicked efficient.

[]x0x7 -0 points

One more thing gives a bit of a hint at what's going on.

  return (retr||undefined)+i;





I'm trying to figure out what kind of magic value retr is that we don't need to worry about it's type before we add to it, and that prints out as undefined while using console.log, and that doesn't seem to win in all cases in the contest of an || but imbues this strange "type to the right hand side" property on what ever wins the || battle, except when it's an object.

I swear the interpreter is actually changing the code around when it goes into the repl.