Import gives this error message

<script type="module" src="maths.js"></script>

This is my HTML code.

function add(a, b) {
    return a + b;
import add from maths.js;

This is my javascript import code, but it has this error message.
Uncaught SyntaxError: Cannot use import statement outside a module
Did I make any mistake at the import code?

@CodeDreamer_Ben ,

Hope this link gives you a clear idea.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.