var MyFunc =
MyFunc ||
(function (u, p) {....})
If this code is in a file named abc.js
and there multiple JS files for the website, how do I print the variable u
in chrome's console?
I tried console.log(u)
, console.log(MyFunc.u)
both didn't work.
If I understand that correctly, you can do this:
var MyFunc =
MyFunc ||
(function (u, p) {
console.log(u);
console.log(p);
}
);
MyFunc(1, 2);
When you run the above code, it will assign anonymous function to MyFunc and then you need to call that function definition by passing the parameters.