Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
// a.js import { getB } from "./b.js"; export function getA() { return "A"; } console.log(getB()); // might be undefined if b.js not fully loaded yet // b.js import { getA } from "./a.js"; export function getB() { return "B + " + getA(); } // Solution: use lazy evaluation export function getB() { const { getA } = require("./a.js"); // import inside function }
Result
Open