How can I compare two sentences in JavaScript to determine if they are equal? [closed]

For example, consider the following sentences:

Sentence 1: “abc 123 poi”

Sentence 2: “poi abc 123”

Is there a way to determine if these sentences are equal in JavaScript?