Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to complete Closures exercise #33

Open
ryoboua opened this issue Apr 21, 2017 · 3 comments
Open

Unable to complete Closures exercise #33

ryoboua opened this issue Apr 21, 2017 · 3 comments

Comments

@ryoboua
Copy link

ryoboua commented Apr 21, 2017

My code is:

function foo(){
var bar;
function zip() {
bar = true;
}
return zip;
}

It fails with:

operator: equal
expected:
  '(global)\n\tfoo()\n\t- var bar\n\t- quux = ?\n\treturn zip\n\t\tzip()\n\t\t- var quux\n\t\t- bar = ?'
actual:
  '(global)\n\tfoo()\n\t- bar = ?\n\treturn zip\n\t\tzip()\n\t\t- bar = ?'
@NolanChan
Copy link

NolanChan commented Apr 28, 2017

Hey @ryoboua , I assume this is for exercise 4?

I believe you need to carry over the quux variables from the previous exercise. This solution worked for me. What you've written is correct though for the focus of the exercise

function foo() {
	var bar;
	quux = true;

	function zip() {
		bar = true;	
		var quux = false;	
	}
	return zip;
}

@chamnap
Copy link

chamnap commented Jun 19, 2017

It's always failed for me.

function foo() {
  var bar;
  quux = "quux";

  function zip () {
    var quux = "quux-zip";
    bar = true;
  }

  return zip;
}

@NolanChan, your solution doesn't get passed too.

@Sceat
Copy link

Sceat commented Jun 18, 2018

you need to keep the var bar ,
so that give

function foo() {
        var bar
        function zip() {
                var quux  
        }
}

note that this weird thing also work lol

function foo() {
        var bar = function zip() {
                var quux
        }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants