I have been trying to import this module which returns live stock prices. Each time I try to import it I get an error from google saying I cannot "use import statement outside of module."
Html Code:
<html lang="en">
<head>
<script src="JSpractice.js"></script>
</head>
<body>
<p id="p">hello world</p>
<button type="button" >Hello world</button>
</body>
</html>
Javascript code:
import { getCurrentPrice } from './modules/yahoo-stock-prices';
document.getElementById("p").innerHTML = getCurrentPrice("AAPL");
Google Error:
JSpractice.js:1 Uncaught SyntaxError: Cannot use import statement outside a module
Any advice?