igelov

Characters in Range

Jun 13th, 2020
1,151
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function charsInRange(char1, char2) {
  2.     let result = '';
  3.     let start = Math.min(char1.charCodeAt(0), char2.charCodeAt(0));
  4.     let end = Math.max(char1.charCodeAt(0), char2.charCodeAt(0));
  5.     for (let i = start + 1; i < end; i++) {
  6.         result += String.fromCharCode(i);
  7.     }
  8.     console.log(result.split('').join(" "));
  9. }
RAW Paste Data