Javascript Solution to Codility Demo Test
For the test at https://codility.com/demo/take-sample-test
the following provides a solution in Javascript:
function solution(A) {
// write your code in JavaScript (Node.js 8.9.4)
let tmp = []
A.forEach(e => {if (0 <= e) tmp[e] = true})
for (let i=1; i<=tmp.length; i++) {
if (tmp[i]===undefined) return i
}
return 1
}