You will have to install a server to run this code, because the marvel api requires you to whitelist the source of requests.
Try in command line:
npm install http-server --global
Then Try in command line:
http-server
This will be default run a server on your computer @ 127.0.0.1 (this is equivalent to localhost) at port 8080. Try visiting in your browser this url:
127.0.0.1:8080