I have the following two strings:
var str1 = \"hello\"; var str2 = \"ehlol\";
How can I check whether both strings contain the same characters?
You could possibly say this:
(a.length === b.length) && (a.split('').every(function(val) { return b.indexOf(val) > -1}))
And, in ES6 you could make it look as follows:
(a.length === b.length) && a.split('').every(val => { return b.indexOf(val) > -1 })