Find missing letter in list of alphabets

前端 未结 16 1709
逝去的感伤
逝去的感伤 2021-01-01 05:15

I am trying to solve the following issue:

Find the missing letter in the passed letter range and return it. If all letters are present in the range, return undefine

16条回答
  •  青春惊慌失措
    2021-01-01 05:35

    Here's my another answer in missing letters:

    function fearNotLetter(str) {
      var alphabet = 'abcdefghijklmnopqrstuvwxyz';
      var first = alphabet.indexOf(str[0]);
      var last = alphabet.indexOf(str[str.length-1]);
      var alpha = alphabet.slice(first,last);
    
      for(var i=0;i

提交回复
热议问题