forked from Automedon/CodeWars-7-kyu-Soluitions
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAlan Partridge I - Partridge Watch.js
More file actions
34 lines (25 loc) · 952 Bytes
/
Copy pathAlan Partridge I - Partridge Watch.js
File metadata and controls
34 lines (25 loc) · 952 Bytes
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
31
32
33
34
/*
Description:
To celebrate today's launch of my Hero's new book: Alan Partridge: Nomad, We have a new series of kata arranged around the great man himself.
Given an array of terms, if any of those terms relate to Alan Partridge, return Mine's a Pint!
The number of ! after the t should be determined by the number of Alan related terms you find in the provided array (x). The related terms are:
Partridge
PearTree
Chat
Dan
Toblerone
Lynn
AlphaPapa
Nomad
If you don't find any related terms, return 'Lynn, I've pierced my foot on a spike!!'
All Hail King Partridge
Other katas in this series:
Alan Partridge II - Apple Turnover
Alan Partridge III - London
*/
function part(x){
const arr=['Partridge','PearTree','Chat','Dan','Toblerone','Lynn','AlphaPapa','Nomad']
let num=x.filter(v=>arr.includes(v)).length
if (arr.some(v=>x.includes(v))) return `Mine\'s a Pint${'!'.repeat(num)}`
return 'Lynn, I\'ve pierced my foot on a spike!!'
}