Advertisement
natalyayemelyanova

Роман Песков 4

Mar 15th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. function doCompare(a, b) {
  2.  
  3. let arr = a.split('');
  4. let arr2 = b.split('');
  5.  
  6. for (let i = 0; i < arr2.length; i++) {
  7. if (arr2[i] === ' ') {
  8. continue;
  9. }
  10.  
  11. if (arr.length == 0) return false;
  12.  
  13. for (let j = 0; j < arr.length; j++) {
  14. if (arr[j] === arr2[i]) {
  15. arr.splice(j, 1);
  16. break;
  17. }
  18. }
  19. }
  20.  
  21. for (let i = 0; i < arr.length; i++) {
  22. if (arr[i] !== ' ') return false;
  23. }
  24. return true;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement