Simularity identification in JS