You can probably find a JavaScript interpretation library written in C++ somewhere. For example, ixlib (
http://ixlib.sourceforge.net/) looks like it may have what you're looking for.
If that doesn't work out, you can also just have your C++ program create a pipe(2), then fork(2) and have the child exec(2) to a JavaScript interpreter. Then pass data back and forth along the pipe. That sounds really complicated, though, and is not really recommended.