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 4f01228

Browse files
add new problem Thinkful-Logic
1 parent 01c6f50 commit 4f01228

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

‎README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@
3131
| Problem - 27 | [Binary Search implementation with JS](https://github.com/MehedilslamRipon/Problem-solving-with-JavaScript/blob/master/problem-27.js) |
3232
| Problem - 28 | [Make a unique random string generator - uuid alternative lite](https://github.com/MehedilslamRipon/Problem-solving-with-JavaScript/blob/master/problem-28.js) |
3333
| Problem - 29 | [Given a set of numbers, return the additive inverse of each. Each positive becomes negatives, and the negatives become positives](https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-29.js) |
34-
<!-- | Problem - 30 | | -->
34+
| Problem - 31 | [Thinkful-Logic](https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-30.js) |
35+
<!-- | Problem - 31 | | -->

‎problem-30.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// You're writing code to control your town's traffic lights. You need a function to handle each change from green, to yellow, to red, and then to green again.
2+
3+
// Complete the function that takes a string as an argument representing the current state of the light and returns a string representing the state the light should change to.
4+
5+
// For example, when the input is green, output should be yellow
6+
7+
8+
function updateLight(current) {
9+
return current == 'green' ? 'yellow' : current == 'yellow' ? 'red' : 'green'
10+
}

0 commit comments

Comments
(0)

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