I am somehow against people expecting me to write syntactical code at job interviews. I prefer to write pseudo code, explain my thought process. Being a guy who deals with various languages throughout the day makes it hard to code everything right when someone looking over my shoulder as I tend to google now and then to get right functions/methods of achieving something. Thats just me I guess.
You're not the only one. I've experienced many types of interviewing: skyping, verbally coding, online code editing, in-person whiteboard coding, homework/coding tests, programming language trivia, math brain teasers, etc. The funny thing is that even when getting all of the questions "correct," they haven't ever gotten me closer to a job offer than more traditional methods.
You can tell within the first 10 seconds of your first interaction with a company if they are actually interested in hiring you, or just window shopping. The conversation starts with the HR person/hiring manager talking up their company, asking about your experience and then essentially asking you how soon you can start.
In other words, if someone doesn't already have a good idea that they want to hire you based on your resume and experience, no amount of code circus is going to move the chains forward.
I work with a lot of languages too. And, this has been something which I have thought a bit about. There are jobs where polyglot skills play a big part (e.g. software consultancy), but there are also jobs which require someone to just go out and crank code. In those cases, I don't think it's wrong for someone to expect syntactical correctness.
Either consider treating your interviewer as "Google".
Or just write down the prototype of the function you need, tell the interviewer what you expect it to do, offer to code it up later if necessary, and use it