I'm creating a simple turn based multiplayer game. I will have some "unit" objects I want pass back and forth. I wanted to define the definition of the object only once. In C++ I would use a header file, and in Java I could implement them them, but in Javascript I don't know how I could achieve this.
I could simply define everything twice, but I have a feeling this might come up again in my future at some point, and I rather learn to deal with it properly now. I'm using Nodejs and Javascript.
As a note, I thinking I could just do a simple HTML but I was having a hard time figuring out how to do the same thing on the server.js, and I'm not sure if this is even how I should be handling this.