-1

I have a working javascript inside an html file.

The script uses a variable

var datalist = [12, 19, 3, 5, 2, 55];

How can i instead of include that data inside my html file, just put it in an external file and load it into the variable inside the html

WingZero
  • 101
  • 1
  • 5

1 Answers1

-1

If you really want to store it an a javascript file

(File imported in head)

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script defer src="file.js"></script>
  <title>title</title>
</head>
<body>
  <!-- code -->
</body>
</html>
Almaszosz
  • 42
  • 7