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

Evaluation error #29

Open
felipebueno opened this issue Oct 30, 2015 · 8 comments
Open

Evaluation error #29

felipebueno opened this issue Oct 30, 2015 · 8 comments
Labels

Comments

@felipebueno
Copy link

Hi!

First, thanks for this great project. I'm learning Javascript (ES6) and React and it's the nicest repl I've found.

I think there's a problem with the evaluation:

function buzz(n) {
  if (n%15 === 0) return 'FizzBuzz';
  if (n%5  === 0) return 'Buzz';
  if (n%3  === 0) return 'Fizz';
  return n;
}

buzz(3)
'Fizz'

buzz(2)
undefined <<<< it should return 2

I tested it on Firefox's console and it works fine.

gif

@felipebueno felipebueno changed the title Evaluarion error Evaluation error Oct 30, 2015
@princejwesley
Copy link
Owner

@felipebueno Working fine for me. I'll try to reproduce it.

image

@felipebueno
Copy link
Author

Oh, nevermind. I've found the problem.

What happens is that I had defined this function before but forgot the return n; on the last line. Then I fixed that hoping that the function would be redefined but it wasn't.

@princejwesley princejwesley removed the bug label Oct 30, 2015
@princejwesley
Copy link
Owner

@felipebueno 😄

@felipebueno
Copy link
Author

But I think it'd be useful to be able to redefine functions without restarting the repl, wouldn't it?

@princejwesley
Copy link
Owner

@felipebueno There is a open bug in node vm(nodejs/node#548).

For time being, use like this:

let fun = function fun() {};
let fun2 = () => {};

@felipebueno
Copy link
Author

@princejwesley Thanks! 😄 👍

@princejwesley
Copy link
Owner

@felipebueno I'll keep this issue open until the vm issue fixed and new version rolled out.

@princejwesley
Copy link
Owner

Temporary fix:

image

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

No branches or pull requests

2 participants