-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.js
30 lines (20 loc) · 809 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import {words} from './index.js'
console.log("-----\nThree most popular words:")
// This will output these words:
words.getMostPopular(3).forEach(word => {
console.log(word)
})
console.log("-----\nThree most popular fifteen letter long words")
words.getMostPopularLength(3, 15).forEach(word => {
console.log(word)
})
console.log("-----\nThree most popular words that match this regular expression.")
words.getMostPopularRegex(3, /able$/).forEach(word => {
console.log(word)
})
console.log("-----\nThree most popular words that this function matches.")
words.getMostPopularFilter(3, word => {return ['popular', 'english', 'words'].includes(word)}).forEach(word => {
console.log(word)
})
console.log("-----\nThe rank of the word 'popular'.")
console.log(words.getWordRank('popular'))