Advertisement
dabidabidesh

isOnlyLettersAndDigits

Jun 12th, 2020
890
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const isOnlyLettersAndDigits = str => {
  2.  
  3.     for (let i = 0; i < str.length; i++) {
  4.  
  5.       let n = str.charCodeAt(i)
  6.       if (!(n >= 97 && n <= 122) && !(n >= 65 && n <= 90) && !(n >= 48 && n <= 57))
  7.         return false
  8.     }
  9.  
  10.     return true
  11.   }
Advertisement
RAW Paste Data Copied
Advertisement