Can someone explain the difference in Javascript between:
var x = something
and
var x : something
I have no idea on where/how to search about it.
I saw the code above at the bottom of page 4 of this document: http://download.unity3d.com/support/Tutorials/2%20-%20Scripting%20Tutorial.pdf
Thanks in advance!
The first one assigns something to a variable x and the other causes a syntax error.
You're probably mixing up assigning a property in an object literal and normal assignment.
var x = something;//assigning a variable
var y = {
x:something//assigning a object property
};
Edit
var target : Transform;
seems to be UnityScript not JavaScript, it looks like it is not assigning a value but rather setting the variable type. see here
UnityScript is not JavaScript
Unity Script vs Javascript
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With