Reputation: 1323
I'm working through Kyle Simpson's "You Don't Know JavaScript" series. At the end of (published 2014) "Scope & Closures" (p. 62), there is an example in ES6 of using the keyword "module" to import an entire module, like so:
// import the entire "foo" and "bar" modules
module foo from "foo";
module bar from "bar";
console.log(
bar.hello( "rhino" )
);
foo.awesome();
This code doesn't work, however. My question is: is the module
keyword something that was experimented with and dropped? Should I forget about this keyword?
Upvotes: 8
Views: 2403
Reputation: 10179
They're typos
// import the entire "foo" and "bar" modules
import foo from "foo"; //fixed
import bar from "bar"; //fixed
console.log(
bar.hello( "rhino" )
);
foo.awesome();
Sometimes, the examples in a book are not 100% accurate in typo, they really make confusion for the beginners.
Upvotes: 5