Hi, I've been programming in Unity for about a year, but I recently started learning web design and JavaScript. What I want to know is why is the syntax different from Unity's JS and web JS? For example, functions in Unity JS must be capitalized, but in the web JS they must be lower cased. And why is it that in Unity JS variables can be declared outside or inside a function, but in web JS, they must be inside? Though, I would assume you can declare them outside of a function in web JS if you give a special perimeter (like in C). For instance, here would be an example of Unity JS: Code (csharp): var num = 1; Function Start(){ Debug.log("Stored var is:" + 1); } While in web JS, something similar (where the function is called in HTML)might be: Code (csharp): function writeDoc() { var num =1; document.write("The stored var is:" +1); } This is just a general question, not really relevant, but I want to understand the language better so if anyone has an answer, yay!
Javascript in Unity isn't actually Javascript at all, so it's best not to think of it that way. It's mostly like JScript.NET, so read this. --Eric