-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBanjo.js
More file actions
21 lines (18 loc) · 690 Bytes
/
Banjo.js
File metadata and controls
21 lines (18 loc) · 690 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*Task/Instructions:
Create a function which answers the question "Are you playing banjo?".
If your name starts with the letter "R" or lower case "r", you are playing banjo!
The function takes a name as its only argument, and returns one of the following strings:
name + " plays banjo"
name + " does not play banjo"
Names given are always valid strings. */
//My answer
function areYouPlayingBanjo(name) {
// if(name.startsWith("R") || name.startsWith("r")) {
// return name + " plays banjo"
// } else {
// return name + " does not play banjo"
// }
return name.startsWith("R") || name.startsWith("r")
? name + " plays banjo"
: name + " does not play banjo";
}