I'm trying to setup a speed test for functions. It works when I pass in a function directly, but I'd like to offer co-workers a form to cut and paste their own.
function sendTest() {
//fName, fContent
var fName = document.getElementById("fName").value;
var fContent = document.getElementById("fContent").value;
var f = new Function(fName, fContent);
f.name = fName;
testTime(f);
}
testTime() is the function to evaluate performance, and evaluating time of execution is working correctly from sendTest(), but I can't access the function name from testTime() to display the function name with the results. f.name and f.fName both come up as undefined.
A function is an object, right? So I should be able to apply a name propery to it?