Created
May 2, 2022 22:46
-
-
Save g-bel/7ebf71a89f56b4592dc36c93eaae1ba6 to your computer and use it in GitHub Desktop.
Cassidy Williams - question of the week 2021-05-02
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dict = ['apple', 'banana', 'cranberry', 'strawberry']; | |
const simpleAutocomplete = (text) => dict.filter(str => str.includes(text)); | |
console.log(JSON.stringify(simpleAutocomplete('app'))); | |
console.log(JSON.stringify(simpleAutocomplete('berry'))); | |
console.log(JSON.stringify(simpleAutocomplete('fart'))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment