Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkString(str1, str2) {
- var string1 = str1.replace(/ /g,''),
- string2 = str2.replace(/ /g,''); // remove whitespaces
- var sort1 = string1.split('').sort().join(''), // sort
- sort2 = string2.split('').sort().join('');
- return sort1 === sort2; // check strings
- }
- console.log(checkString('clockwise', 'owe clicks'));
- console.log(checkString('clockwise', 'clockwork'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement