why I can log the imported variable but it show undefined when I added to another variable.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script type="module" src="index.js"></script>
</body>
</html>
index.js
import log from './log.js';
export var test = 'Hello';
log();
log.js
import { test } from './index.js';
var x = test + ' Word'
export default function log() {
console.log(test);
console.log(x);
}
console log
Hello
undefined Word