Yes you can do this, there are posts in Stack Overflow showing how to execute JavaScript code in C#.
But you will face huge problems getting same output in C# (written code or javascript enbeded interpreter) because of floating point differences between Programming languages.
My suggestions for you:
If your javscript code has complex math computing, using exact same code (C# vs javscriptengine v8 - browser) you will get different values as results.
Fix can be implemented using floating point predictions/patterns but you will have crap load of work, I fixed this in a lucky way (umber fast server, no one noticed server communications) executing math operations on server and js handled variables as string "".
Example:
based on javascript number type similar but not equal!!! with C# double
javacript math:
var x = 0.1 + 0.2;
result => 0.30000000000000004
C# math:
double x = 0.1 + 0.2;
result => 0.3
Think twice before wasting tones of time (like I did) and not getting what you need.