Advertisement
SuperOP535

how to concat

Oct 26th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // how to concat
  2. let string = 'hello';
  3. let string2 = 'world';
  4.  
  5. string + string2; // ehh
  6.  
  7. let cc = '';
  8. cc += string;
  9. cc += string2; // unsure
  10.  
  11. [string, string2].join(''); // maybe
  12.  
  13. for(var cc = string, i = 0; i < string2.length; i++) cc += string2.charAt(i); // is this pro code?
  14.  
  15. [...string].concat([...string2]).join(''); // ooouh, the es6 way, always better..?
  16.  
  17. string.split('').concat(string2.split('')).join(''); // 4 of 5 stars, better browser support is a plus
  18.  
  19. string2.split('').reverse().concat(string.split('').reverse()).reverse().join(''); // pro code, for sure.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement