I am stuck in a js function.
function test() {
setTimeout(function() {
console.log('hrllo')
return "I love You !!";
}, 3000);
}
function main() {
var result = test();
console.log(result); // must be I love You !!
}
I am working in pure Js which is JS 2017 supported means we can use async, await or promise. Can anybody please help me achieve the result?