Quick tip: In your pre-ES2015 callApi() example, token and type would have to be defined above the function call, to be equivalent to the first version.
Otherwise they exist only inside your callback. ;)
The thing is that you can't use token and type in the body of the caller of callApi bc you don't know if the callback was called and it's side-effects were produced.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice article!
Quick tip: In your pre-ES2015 callApi() example,
token
andtype
would have to be defined above the function call, to be equivalent to the first version.Otherwise they exist only inside your callback. ;)
e.g.:
The thing is that you can't use
token
andtype
in the body of the caller of callApi bc you don't know if the callback was called and it's side-effects were produced.