I thought that myColor would be accessible from sayColor() local context but it isn't even though I'm declaring myColor after the first alert. Why?

var myColor = "blue";
function sayColor() {
    alert(myColor); //undefined expected blue
    var myColor = "green";
    alert(myColor); //green
}
sayColor();
Edit
Report