Skip to content

Instantly share code, notes, and snippets.

View mhmdshorafa's full-sized avatar
🏠
Working from home

Mhmd Shorafa mhmdshorafa

🏠
Working from home
  • Gaza
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mhmdshorafa on github.
  • I am mhmdshorafa (https://keybase.io/mhmdshorafa) on keybase.
  • I have a public key ASBzc4MvLPyrfflMidihv-B7AhgAU2qdK1vCeHfBfXWzKwo

To claim this, I am signing this object:

@mhmdshorafa
mhmdshorafa / chalenge.js
Created December 11, 2017 09:11
function to solve kareem internship challenge
const firstNonRepeatingLetter = (inputString) => {
const letters = inputString.toLowerCase().split('');
const firstNonRepeated = letters.map( letter => letters.filter( l => letter === l )).filter(repeated => repeated.length === 1);
const nonRepeated = firstNonRepeated[0];
if (nonRepeated === undefined) return '';
else return inputString[letters.indexOf(nonRepeated[0])];
}
module.exports = firstNonRepeatingLetter;