Advertisement
natalyayemelyanova

Антон Плескач

Apr 2nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. let string = "clockwise";
  2. let srting1 = "clockwork"; // "owe clicks";
  3.  
  4. function compareString(_string, _string1) {
  5. let arr = _string.split("");
  6. let arr1 = _string1.split("");
  7. let result = true;
  8.  
  9. arr.forEach(ls => {
  10. let res = arr.filter(l => l === ls);
  11. let res1 = arr1.filter(l => l === ls);
  12.  
  13. if (res.length !== res1.length) result = false;
  14. });
  15.  
  16. console.log(result);
  17. }
  18.  
  19. compareString(string, srting1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement