const xml2json = require("xml-to-json");
const convertXMITOJSON = () => {
xml2json(
{
input: "./sequence_diagram.xmi",
output: "./test.json",
},
function (err, result) {
if (err) console.error(err);
else {
return result;
}
}
);
};
let result = convertXMITOJSON();
console.log(result); // undefined
I want to use the value of result outside of this function. But when I return the value of result, it's getting undefined. Why is in this code the value of result outside the function undefined?