You would need a JS runtime compiled for your target device, or a standalone JS compiler for your target device.
EDIT: Assumed you meant running JS on-the-metal. If you're running an OS then you could just have a JS interpreter (or V8) running on it.
How do you define an interrupt handler in JS?