Open arku opened 8 years ago
The solution is below:
function foo() {
var bar
}
@lenguyenthanh I've been running into the same problem. I tried your solution but I get a syntax error. Same if I try function foo(){ var bar; } Anybody any ideas what I'm doing wrong?
@LisaKhadijah what is your syntax error? It looks correct.
@lenguyenthanh
I don't get any specific error. If i run scope-chains-closures verify
@lenguyenthanh shouldn't @arun1595 solution be valid too though?
@lenguyenthanh the solution of @arun1595 is a valid kind to define a function. this workshop shouldn't make a difference between function declaration and function expression.
Assigning a function to a variable did not give it a name in Node versions prior to 6:
var foo = function () {}
console.log(foo.name)
console.log((function bar() {}).name)
So that, and I think that the validation is harder were the reasons why this doesn't work. A PR that fixes this would be good imo.
The challenge asks us to create a function foo and lexically scope a variable bar. My solution was
However one of the tests fail. I think the above solution is also right and should be accepted. Correct me if I am wrong.