A simple selection sort algorithm in JS