I am new to javascript. I have a js file something like below(test.js):
async function getData() {
let a =100;
// Some other function calls which modifies a
// Some more console logs here.
return a;
}
(async () => {
console.log(await getData()); // When trying to return await getData() giving some error.
})();
I am executing the above script output = $(node test.js) in shell script and I need the value of a in the shell script but here I am getting all the console.log statements. Is it possible to get the value?
output=$(node test.js)and there is no space around the=signshellscript to question?