My question may seem straightforward, but I'm having trouble finding the right solution.
Within my index.html
file, I have the following content:
<html>
<head>
<script src="scalar.js"></script>
</head>
<body>
</body>
<script>
function myFunction() {
for (i = 0; i < data.length; i++) {
data[i] *= 5
}
alert(data)
}
</script>
</head>
In the same directory, there's a file named scalar.js
with the line:
var data = [10, 20, 30, 40];
The issue I'm facing is that the array defined in scalar.js
is not being utilized in index.html
. I've tried including
<script src="scalar.js"></script>
within the body of the HTML file, but it doesn't work.
I would greatly appreciate any assistance! (I prefer to keep the data variable defined in scalar.js rather than setting it in the index file).
UPDATE: Take a look at the code on https://github.com/amosallaei19/NEURepo