I’m looking for a method to run external javascript frm v8 shell.
For running a javascript in v8 shell, the whole script should be in a one line. Otherwise v8 shell gives syntax errors in the javascript.
What I can do to run bit of large javascript code from v8 shell?
I have successfully run javascripts from the consolse.It works fine.When it comes to run bit of large javascript codes v8 gives sysntax errors but when I removed new lines it worked.I just want to know is there a way to run javascript from external file.
function strAdd1()
{
var start = new Date().valueOf();
var str = "This is the string that will be tested. it is a long one with numbers 1234567890";
for(var i=0;i<100000;i++)
{
str += "This is the string that will be tested. it is a long one with numbers 1234567890";
}
return new Date().valueOf() - start;
}
Do you mean
How to load external javascript file from v8 shell?Then, use
load.foo.js
call
load()However, this is a function for just only v8 shell. so if you want to use generally way on javascript, you should improve v8 shell.