Problem, as an interviewer would state it:
"Implement Array.prototype.mySome and myEvery from scratch — matching real native behavior, including that both genuinely SHORT-CIRCUIT rather than checking every element."
Examples:
[1,2,3,4,5].mySome(n => n === 3); // true, and STOPS checking after finding it
Clarifying questions expected:
- Do both methods need to genuinely stop early once the answer is already determined, or is checking every element acceptable?
- What is the real, correct result for an empty array — for some(), and separately for every()?
- Do these two methods need to be implemented as genuinely separate functions, or could one be derived from the other?
Code / implementation expected: Yes — real, direct proof of correct output matching native, PLUS real, direct proof of genuine short-circuiting via a logged list of exactly which elements were checked before stopping.