Global vs Local Scope in Functions, freeCodeCamp Basic Javascript

preview_player
Показать описание
In this challenge we learn about global vs local scope in functions. It is possible to have both global and local variables with the same name. In a javascript function, the local variable willl always take precedence over the global variable.
Рекомендации по теме
Комментарии
Автор

so if we did return outerWear outside if the myOutfit function, would it output "T-shirt" instead?

jonathanortiz
Автор

Dunno what i did wrong but it's not returning any statement .
Here is my code.

var name = "David";
function ourNames() {
var name = "Sammy";
return name;
}

andfthxcvjdyi