Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function compaireStrings(str1, str2) {
- let arr1 = str1.toLowerCase().split('');
- let arr2 = str2.toLowerCase().split(' ').join('').split('');
- arr1.sort();
- arr2.sort();
- if (arr1.length !== arr2.length) {
- return false;
- }
- for (let i = 0; i < arr1.length; i++) {
- if (arr1[i] !== arr2[i]) {
- return false;
- }
- }
- return true;
- }
- console.log(compaireStrings('clockwise', 'owe clicks'));
- console.log(compaireStrings('clockwise', 'clockwork'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement