function x(a,b) { return a.split("").sort().join("") == b.split("").sort().join("") } alert(x("Iowa","oIaw")); alert(x("Iowa","aIow")); alert(x("Iowa","stateIowa")); alert(x("Iowa","Io wa"));