Advertisement
dabidabidesh

charactersInRange0

Jun 21st, 2020
2,450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function charactersInRange0(ch1, ch2) {
  2.   'use strict'
  3.  
  4.   let n1 = ch1.charCodeAt(0)
  5.   let n2 = ch2.charCodeAt(0)
  6.  
  7.   //min и max
  8.   const swap = (a, b) => {
  9.     if (a > b) {
  10.       let c = b
  11.       b = a
  12.       a = c
  13.     }
  14.     return [a, b]
  15.   }
  16.  
  17.   [n1, n2] = swap(n1, n2)
  18.  
  19.   let output = ''
  20.   for (let i = n1 + 1; i < n2; i++)
  21.     output += String.fromCharCode(i) + ' '
  22.  
  23.   console.log(output)
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement