I'm making a simple socket.io game and I need client/client.js to be able to use variables and funtions from index.js You can check the project out here: https://repl.it/@Helixable/Sword-Arena-v10 Please help me. I'm new to javascript and this is like coder's block for me. How can I fix this without using the alert method?
On this site and on the web there are several entries that answer your question, making a simple search you should find them, I leave a couple of results.
Can I access variables from another file?
Can we call the function written in one JavaScript in another JS file?
Do not forget before asking to spend a few minutes searching if there are any similar questions.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.