-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearchForLetters.js
More file actions
23 lines (16 loc) · 817 Bytes
/
SearchForLetters.js
File metadata and controls
23 lines (16 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var change=(string)=> {
string = string.toLowerCase();
return 'abcdefghijklmnopqrstuvwxyz'.split('').map(i=>{return string.indexOf(i) == -1 ? 0 : 1;}).join('');}
/*
Create a function which accepts one arbitrary string as an argument,
and return a string of length 26.
The objective is to set each of the 26 characters of the output string
to either '1' or '0' based on the fact whether the Nth letter of the
alphabet is present in the input (independent of its case).
So if an 'a' or an 'A' appears anywhere in the input string (any number
of times), set the first character of the output string to '1',
otherwise to '0'. if 'b' or 'B' appears in the string, set the second
character to '1', and so on for the rest of the alphabet.
For instance:
"a **& cZ" => "10100000000000000000000001"
*/