I have a web project that has the following lines of code in it
<script>var obj = {...}</script>
<script src='./app.js'></script>
./app.js loaded by the second script tag uses obj defined by the first script tag. You could say that obj is a global variable to ./app.js.
I don't want to define obj inside ./app.js because it's a very large object but is this bad practice to define global variables like this?
Aucun commentaire:
Enregistrer un commentaire