This question is about the same names of function and variable. Please tell me - why this code doesn't have errors:
var Task = new Task();
function Task() {
console.log('work!');
}
but this one won't work:
start();
function start() {
var Task = new Task();
};
function Task() {
console.log('work!');
}
Why it's so?
Taskvariable works outside of the function but not inside.