質問

in firefox contenscript when i tried this method it is not working

var x = function(y) {
   return y * y;
};

in firefox they mdn page https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function#Examples

but this function works very neatly in crome extension and it is a javascript function in my knowledge. thanks in advance

here is the test extension github

役に立ちましたか?

解決

I think you want to actually execute the function and pass a parameter in your test code, rather than just output the function definition to the console. So change:

console.log("x :", x);

to:

console.log("x :", x(2));
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top