I got this js line:
var functest = function(){
if (this.href === "undefined") {
return window.location
} else {
return this.href
}
};
Basically I want this if function to return the variable necesarry and assign it to functest.
This obviously is not working and returns the function as a string somehow. How should I do this?
functestthe function. To prove this write the following codefunctest();this will call the above function and return either the href or the window.locationwindow.location.href, not justwindow.locationthis.href === "undefined"Drop the quotesthis.href === undefinedundefinedis a good solution.