Advertisement
Lulunga

Characters in range

Jun 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. function solve (charOne, charTwo){
  2. let firstCode = charOne.charCodeAt(0);
  3. let lastCode=charTwo.charCodeAt(0);
  4. let start=Math.min(firstCode, lastCode);
  5. let end=Math.max(firstCode, lastCode);
  6. let characters=[];
  7. for (let i = start+1; i < end; i++) {
  8. let currentCharacter=String.fromCharCode(i);
  9. characters.push(currentCharacter);
  10. }
  11. console.log(characters.join(' '));
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement