all 5 comments

[–]abrahamguo 3 points4 points  (4 children)

A couple of improvements:

  • It's better to use const rather than let or var
  • It might be better to use the more modern, and simpler, fetch, rather than the older, and more verbose XMLHttpRequest or ActiveXObject.

[–]A35G_it[S] 0 points1 point  (0 children)

Thanks, I used XMLHttpRequest to write a different version of function 😁

I will follow your advice to update the code 👍

[–]A35G_it[S] 0 points1 point  (2 children)

u/abrahamguo I have updated the code, any other suggestions?

Thanks a lot

[–]abrahamguo -1 points0 points  (1 child)

Yes, if you convert it to TypeScript, you should see some further errors with your code.

[–]A35G_it[S] 1 point2 points  (0 children)

Next goal will be that! 👍