How is it possible that script continues even without proper setting variable? Thanks for reply!
Code
function get(param) {
// Connect to database and get the response ~ 1 sec
db.get(param, function(output) {
console.log("Hey, I set the variable!");
return output;
});
}
try {
var username = get("username");
var birthday = get("birthday");
} catch (e) {
error = e;
}
if ( !error ) {
console.log("No errors? Everything all right?");
}
Output
No errors? Everything all right?
Hey, I set the variable!