Why import in js not working?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    

    11212


    <script src="./index.js"></script>
</body>
</html>
//index.js file
import {obj} from './data.js'

console.log('000111010');

console.log(obj)
//data.js file

let obj = {a:4,f:44,d:[1,2,3,4,]}

export default obj

Error in console:

 Uncaught SyntaxError: Cannot use import statement outside a module    index.js:1