How can I “return” the “result” value form this function? Where should I put the “return result” sentence to get the right value ( I mean IPFS hash value)?
You can’t really return the result. You are within a callback function, this means you would pass on the result into another function instead of returning it.
Your problem is not really related to IPFS, it’s a JavaScript question. So finding out how asynchronous programming with callbacks in JavaScript work should get you started.
AddJSON seems return CID (or hash of your json) so if you need to return hash yep. after vmx have reason here you cannot return result you run a callback.