Step 2-01 updates

This commit is contained in:
Elizabeth Craig
2019-02-27 20:17:08 -08:00
parent fdceb93839
commit 61ae8afdf1
11 changed files with 126 additions and 81 deletions

View File

@@ -1,10 +1,10 @@
// These are named imports from a file relative to this file
import { namedConst, namedFn, namedObj, namedConstBracket } from './named';
// We can even apply an alias to the named constant
// We can even give an alias to the named constant
import { namedConst as c } from './named';
// These are the same instances of the named imports, but gets imported all at the same time under a single object
// These are the *same instances* of the named imports, but they all get imported inside a single object
import * as named from './named';
// Print out the exports
@@ -14,12 +14,15 @@ console.log(namedFn());
console.log(namedObj);
console.log(namedConstBracket);
// Print out exports through module level import
// Print out exports from module level import
console.log(named.namedConst);
console.log(named.namedFn());
console.log(named.namedObj);
console.log(named.namedConstBracket);
// The named and module-level imports reference the same object instances
console.log(namedObj === named.namedObj); // true
// Default import can be named anything we want as the consumer
import DefaultClass from './default';
import Foo from './default';