This is not about writing the most readable or production-ready code. Its a fun test of versatility and language knowledge.
Answers should work on all major browsers except where denoted with “ECMA 5” (in which case they should work on all browsers except IE<9) . The number in parentheses indicates how many characters were in my solution, including semicolons but omitting returns and extra spaces.
I’ll post my solutions on Monday. Good luck! (Spoiler alert – some solutions in comments)
1.Variable f is an array of functions. One of them takes no formal parameters: Invoke it. (53 characters)
2. Variable a is an array. Make an array of the non-falsey (i.e. not undefined, null, 0 etc.) values in a. (ECMA 5) (18)
3. Variables a, b and c reference numbers. Verify b is exclusively bound by a and c without using <,> or arithmetic operators (+, -, *, /) (21) edit: my answer fails for multi-digit numbers
4. Verify that x is true. Don’t use true, false or any other variable, value or function (apart from x) (12)
5. Swap the values of variables a and b without using another variable or property (13)
6. Is n an integer? (7)
7. x is an array of numbers. Get the maximum value in x (20)
8. If b is not a member of array a, add it to the end of the array (ECMA 5) (25)
9. Make a string consisting of string x repeated n times (23)
10. Concatenate arrays a and b without using concat (18)