Ask yourself two questions:
- How well off am I for job offers?
- Is my code a selling point?
If you're an experienced developer with offers coming out of your ears and the phone ringing off the hook, then you probably don't need to bother investing a bunch of time on a coding exercise. You might make an exception if you really like the sound of the job, but you've got enough offers to choose from that you don't need to invest your time if you don't want to.
If you're more junior, and you need the opportunities - then is your code a selling point? Will the interviewers read it and see potential or will they run a mile? Do you structure things logically, comment things sensibly, employ best practice and generally write good, clean, well-designed code?
I'm a grad with one year of experience. I sound okay on paper. I even come across fairly well in interviews. But if they give me a coding exercise, that's my chance to really shine. So I take the chance if I can get it. It gives me a higher chance of getting an interview.
Finally, consider that they'll probably make you write code at some point in the interview process. I personally prefer being able to write things at home in my own time and with access to Google and a compiler, rather than sweating in front of a whiteboard with everyone looking at me. Other people will prefer to do it on the whiteboard where they can talk to actual human beings and aren't going to be judged on every misplaced comma. Think about which option would work better for you.