I am writing a raytracer as a part of my complete 3d engine. I am planning on using javascript for the scripting language instead of writing my own. The question is how can
There are many standalone implementations of JavaScript that you may be able to leverage for this purpose:
Here is a link to the stackoverflow info page on JavaScript which lists at the top many of these implementations: https://stackoverflow.com/tags/javascript/info