now we all agree that the promotion of function declaration takes precedence over the promotion of variable declaration. Can you give me an example to prove this point?
the following example does not prove this point
console.log(person); // person() { console.log("function")}
function person() {
console.log("function")
}
console.log(person); // person() { console.log("function")}
var person = "variable";
console.log(person);//variable
whether variable declaration or function declaration takes precedence, the result is the same;
//
var person;
function person() {
console.log("function")
}
console.log(person); // person() { console.log("function")}
console.log(person); // person() { console.log("function")}
person = "variable";
console.log(person);//variable
//
function person() {
console.log("function")
}
var person;
console.log(person); // person() { console.log("function")}
console.log(person); // person() { console.log("function")}
person = "variable";
console.log(person);//variable
Please give us an example that can be proved, or if there is anything wrong with the above, thank you very much