Closed S4sh closed 7 years ago
@S4sh thank you for opening this issue! 👍
Yeah, Blanket.js
only allows JS that "works everywhere" ...
Perhaps a couple of lines in the readme informing people to use the function
keyword would be good. 🤔
Also, =>
are a nice convenience, however: https://plus.google.com/+DouglasCrockfordEsq/posts/TxQ4gRkZxST
@nelsonic To counter Douglas Crockford argument: https://medium.com/javascript-scene/familiarity-bias-is-holding-you-back-its-time-to-embrace-arrow-functions-3d37e1a9bb75
I believe arrow functions are a good thing, but that is my opinion. What would be your opinion of re-doing the tutorial using Mocha + chai, or some other more recent framework?
People (especially new generations), will use ES6. I think it only makes sense to write a tutorial that supports it - You don't have to use it, but you should at least support it.
Thoughts ?
thank you @nelsonic
I think as a quick "workaround" it would be totally sufficient to give people a hint. For a "refactored" version of this tutorial, imho Mocha + chai (+ sinon) is seen as the tool of choice these days.
I also think that for future versions ES6 should be supported as it will work everywhere hopefully in the foreseeable future.
But, as said, for the time being, the tutorial fullfills it purpose very, very well.
@Fl4m3Ph03n1x, Eric's post is what drove me to consider fully functional programming languages (i.e. Elixir & Elm) and I have not looked back!
I wrote my own getChange function, but when clicking on "Enable covarage", chrome throws this error:
blanket.js:1161 Uncaught Error: Line 14: Unexpected token > at throwError (blanket.js:1161) at throwUnexpected (blanket.js:1218) at parsePrimaryExpression (blanket.js:1564) at blanket.js:3601 at trackLeftHandSideExpressionAllowCall (blanket.js:3496) at parsePostfixExpression (blanket.js:1700) at blanket.js:3601 at parseUnaryExpression (blanket.js:1780) at blanket.js:3601 at parseMultiplicativeExpression (blanket.js:1786)
When replacing my own with your function everything works fine.
My function:
SOLVED:
Writing this function, I found the problem (- not that I haven't tried before). Blanket.js does not accept ES6 arrow functions. So replacing (coin) => {...} with function(coin) {...} does the job.
So maybe you'd like to give a hint to others or use my function as another solution.
BTW: Great work! Your tutorials help me a lot and are perfectly written and understandable!