I am using node.js and the Translate library . Can I do something like this?
function traduce(text){ translate.text(text,function(err,result){ return result; }); }
And then use the result? It always returns me "undefined". is there any way to use the result without this?:.
translate.text(text,function(err,result){ // use result // some logic });
You are not executing a function, you are passing a link to an anonymous function. If you want to get the return value, execute it:
function traduce(text){ translate.text(text, (function(err,result){ return result; })()); }
, , . , , node.js .
api google, . , , .
30 . , , -, ? , node.js - "waitFor", . , ,