Trimmed whitespace.
Fixed spelling typo.
Declare 'tx' only once.
Declare 'ty' only once.
Use strict === checking.
Easier to read.
Array literal notation is preferable.