Pergunta

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

Foi útil?

Solução

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));
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top