Closed PolarisTLX closed 5 years ago
Hi. The chances of getting this code to run in the browser console are pretty slim — you can't do import
there.
Node similarly does not support import
natively, but if you go to http://eloquentjavascript.net/code/#11 and download both of the files linked there into a directory, you'll be able to run 11_async.js
with node. You could edit the file, adding code at the bottom, try things out (though note that you may need to introduce a delay if your code requires the routing information being available—propagating that between the nests takes a moment)
I am going through Chapter 11 - Asynchronous Programming from the 3rd Edition, again to try and better understand it. To do so I have been trying to actually get the code to run with the examples provided, but I have spent many hours yet nothing works right from:
First it is the curly brace " { " from
import {bigOak} from "./crow-tech";
that the console in the browser does not like.I also got the file crow-tech.js from the sandbox. But I kept getting that error.
So then I start applying all of my knowledge of JavaScript, including trying to get this working with setting up the project folder with:
This finally removes that error about the curly brace " { " .
But I keep getting several others due to the order of how the variables and constants ant functions are defined in the file
crow-tech.js
.I re-arrange all the variables till it stops complaining about them,
But then get this message:
Uncaught TypeError: Illegal constructor
onthis.nodes[name] = new Node(name, reachable[name], this, storageFor(name))
How is this solved? Was the code in this chapter ever supposed to be able to be run on one's machine?
Help / clarification on getting this code to run, or if it even CAN be run would be much appreciated.