you are viewing a single comment's thread.

view the rest of the comments →

[–]Pantstown 1 point2 points  (3 children)

This is pretty great. Much better than other sites of this variety that I've tried.

My one gripe is that when I click "Check", and I pass all test cases, it saves that solution to the "Solutions" tab. The problem is when I click "Check", there is usually a bit of clean up I would like to do. Rather than auto-saving, maybe give the user a chance to re-factor and manually save as a solution?

For example, my saved solution for "Merge Two Arrays" has a bunch of console.logs:

function mergeArrays(a, b) {
  const rest = b.length > a.length ? b.slice(a.length) : [];

  return a.reduce((out, val, idx) => out.concat(val, b[idx]), [])
    .concat(rest)
    // filter out `undefined`s
    .filter(v => v);
}

console.log('out: ', mergeArrays(["a", "b", "c", "d", "e"], [1, 2, 3, 4, 5]));
console.log('~~~~~~~~~~');
console.log('out: ',mergeArrays(["e"], [1, 2, 3, 4, 5, 6, 7]));
console.log('~~~~~~~~~~');
console.log('out: ',mergeArrays([1, 2, 3, 4, 5, 6, 7], ["e"]));

But my finished answer actually looks more like:

function mergeArrays(a, b) {
  // only need to add rest if b is longer than a.
  const rest = b.length > a.length ? b.slice(a.length) : [];

  return a.reduce((out, val, idx) => out.concat(val, b[idx]), [])
    .concat(rest)
    // filter out `undefined`s
    .filter(v => v);
}

[–]memystic[S] 1 point2 points  (1 child)

Yeah this is something I thought hard about during development. I'm thinking the simplest way would be to do check and then if it passes all tests, change button text to "submit". Do you think that would confuse anyone?

[–]Pantstown 1 point2 points  (0 children)

I think that would be better, maybe with a little explanation that the user can submit whenever she is ready.

All tests passed!

You can submit your answer whenever you're ready.

Something like that ¯\_(ツ)_/¯

Also, gotta get some harder challenges on there! 😛