I was clustering around 40000 points using kmean algorithm. In the first version of the program I wrote the euclidean distance function like this
var euclide
First You should be aware of this in the case of for/in and arrays. No big deal if You know what You are doing.
I run some very simple tests to show the difference in performance between different loops: http://jsben.ch/#/BQhED
That is why prefer to use classic for loop for arrays.