Anybody know what's wrong with my code? I used Visual Studio Code to write, when I run this code, it shows "TypeError: Cannot read properties of undefined (reading 'then')"
let sentToAirport = true;
let p = new Promise(function(resolve, reject) {
if (sentToAirport) {
console.log('sent to airport');
resolve();
} else {
reject();
}
});
p.then(function() {
console.log('promise resolved');
});