Ran out of time for the JS questions.
I'll be honest and state that I have never claimed to be a JS advanced/senior developer and although have used NodeJS occassionally, it's not something I rely on for my 'bread-and-butter'; that's Cf (and typically server-side). The dbconnect.js in partciular is a very primitive rendition of NodeJS code required.
I have been doing these test questions over a period of time when I have been able to snatch a half-hour here or there. I have decided to submit now as I have already spent over 3hrs on them (in-between other things), and decided that the answers I have given, whilst not 'Production ready' probably give a fair indication of my coding style and approach.