#What the different between 3 functions below?
function Test(x) {
console.log(x);
var x = 10;
console.log(x);
}
function TestP(x) {
return new Promise(function(fulfill, reject){
console.log(x);
x = 10;
console.log(x);
})
}
function TestP1(x) {
return new Promise(function(fulfill, reject){
console.log(x);
var x = 10;
console.log(x);
})
}
Test(5);
TestP(5).then();
TestP1(5).then();