Check for the condition of anagram
let copy_S1 = S1 , copy_S2 = S2 ; let t1 = copy_S1 . split ( ' ' ) let t2 = copy_S2 . split ( ' ' ) t1 . sort ( ) ; t2 . sort ( ) ; copy_S1 = t1 . join ( " " ) ; copy_S2 = t2 . join ( " " ) ; if ( copy_S1 != copy_S2 ) { return false ; }