Hi
Suppose I have a script.js file that contain hundred line of code, could I call this file and ONLY run the 开发者_StackOverflow社区designated line of code?You should create functions in your script file.
You can then call whichever functions you want.
You can even pass parameters!
You can do this
var script = ... text of your file ...;
var N = ... line number
eval(script.split("\n")[N]);
This will execute (evaluate) line #N in your script.
精彩评论