unfamiliar typecast issue of array


Today i am working on a project in which i want to insert an array value to a textfield i use this syntex

tf.text = Array(getValues()).join(“,”);

function getValues():Array
//return Array
return new Array(“a”,”s”,”d”,”f”);

i got a warning :
Array(x) behaves the same as new Array(x). To cast a value to type Array use the expression x as Array instead of Array(x).

so next time if you want to typecast array use

tf.text = (getValues() as Array).join(“,”);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s