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) {
// 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);
}
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?
2
u/Pantstown Feb 14 '17
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:But my finished answer actually looks more like: