Ad
  • Custom User Avatar

    If you look at above the code window there's a dropdown next to language version (the one says JavaScript) and it should say Node something. That's the version of the language you're using.

    It's very important because you need to check the compiler/runtime version to know what's available and what's deprecated (e.g Node 0.11 won't have any ES6 stuff) ;-) For Node you should choose the latest version in general, but I wouldn't suggest the Babel ones because of the above reason.

    Oh, and by the way, Babel is a transpiler for JS. Basically it takes JS code and tranform it into different JS code, for compability or (psuedo) support for newer language features ahead of the JS engine version.

  • Custom User Avatar

    This looks like your code's problem. Check parentheses and braces ;-)

    (Also I'd suggest to avoid the use of the Babel language versions whenever possible, they give very bad error messages about syntax errors in code.)

  • Custom User Avatar

    Your function will be called many times. Think about what happens at the second call ;-)