Difference of Javascript & C#

What is the difference of Javascript and C#

Wich is easier to learn?
Can you do the same things with it?

2 Answers

2

UnityScript is not exactly JavaScript, that should be noted. The differences are not that huge compared to C#, but US uses duck typing, so you don’t have to explicitly declare a variable with a type, which may seem convenient, but it will also make a beginner write sloppy code.
In UnityScript you don’t declare a class if you’re writing a script component. Unity does that for you, so you just write code and it will be in the class that’s your script’s name… which is again, not good for a beginner. Coroutines and argument passing niceties (by-ref) are also dumbed down in JavaScript. In fact, a lot of things are dumbed down, which limits your potential understanding of important contepts.

If you’re a beginner in programming, learn C#. Not from a Unity tutorial, but general C# tutorials or books. You have to learn about object oriented programming but even that is not “chapter1” thing if you’re just starting out. If you want to learn to program, go with C#, definitely. Later if you want to use a dumber language like JavaScript, it will be much easier than going from JS to C#. C# is a more powerful language by the way, and every .NET/Mono-specific documentation / tutorial you may need is in C#, because it’s the No.1. language of the .NET platform.

You can find a ton of tutorials and books on both languages if you search for them, this seems like a comprehensive one:

http://www.csharp-station.com/tutorial.aspx

If you feel comfortable with C#, you can avoid the trivial problems people usually have, because game development is mostly about programming, and you must not skip that part… it will worth your time.

I disagree with the other reply , javascript is better because it’s simpler and just as powerful as C#. And if you learn javascript first , you’ll easily get the hang of C# . And C# is very good for developers who also program outside unity. C# is basically javascript except you have to rename functions to voids , you have to declare a class, and the syntax is only slightly different.

So my verdict is , if you are dedicated to unity , learn javascript and stick with it but anyone who wants to go further in developing , you should learn javascript first then go onto C#