Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 46d772f

Browse files
author
programmiri
committed
Add first quick and dirty solution raindrops
1 parent 2528636 commit 46d772f

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

‎raindrops/raindrops.js‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
//
2-
// This is only a SKELETON file for the 'Raindrops' exercise. It's been provided as a
3-
// convenience to get you started writing code faster.
4-
//
1+
export const convert = (input) => {
2+
let result = '';
53

6-
export const convert = () => {
7-
throw new Error("Remove this statement and implement this function");
4+
if (input % 3 === 0) {
5+
result = result + 'Pling';
6+
}
7+
if (input % 5 === 0) {
8+
result = result + 'Plang';
9+
}
10+
if (input % 7 === 0) {
11+
result = result + 'Plong';
12+
}
13+
return result.length > 0 ? result : input.toString();
814
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /