Increment the frequency for occurence in s2
for ( let ch = 0 ; ch < s2 . length ; ch ++ ) { freq [ s2 [ ch ] . charCodeAt ( 0 ) - ' ' . charCodeAt ( 0 ) ] ++ ; } let isAllChangesPrime = true ; for ( let i = 0 ; i < 26 ; i ++ ) {