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 939f3c2

Browse files
add new problems and solutions
1 parent 171121f commit 939f3c2

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

‎README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,8 @@
4141
| Problem - 37 | [sum of an array](https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-37.js) |
4242
| Problem - 38 | [biggest number of an array](https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-38.js) |
4343
| Problem - 39 | [sum of n numbers with one argument ](https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-39.js) |
44+
| Problem - 40 | [Vowel and Consonant ](https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-40.js) |
45+
| Problem - 41 | [Find month name. ](https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-41.js) |
46+
| Problem - 42 | [Multiplication table. ](https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-42.js) |
4447

45-
<!-- | Problem - 40 | | -->
48+
<!-- | Problem - 43 | | -->

‎problem-40.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Take a small letter alphabet as a functuion peramitter and print whether it is VOWEL or CONSONANT.
2+
3+
const solution = (letter)=> {
4+
return letter == 'a' || letter == 'e' || letter == 'u' ||
5+
letter == 'o' || letter == "i" ? "VOWEL" : "CONSTANT"
6+
};
7+
8+
9+
console.log(solution('a')); // VOWEL
10+
console.log(solution('u')); // VOWEL
11+
console.log(solution('k')); // CONSONANT

‎problem-41.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Write a program that takes an integer as input 1 - 12 and print
2+
// the corresponding month name. if user gives input 1 you should print 'January'.
3+
4+
const solution = (integer)=> {
5+
return integer == 1 ? "January" : integer == 2 ? "February" : integer == 3 ? "March" : integer == 4 ? "April"
6+
: integer == 5 ? "May" : integer == 6 ? "June" : integer == 7 ? "July" : integer == 8 ? "August" :
7+
integer == 9 ? "September" : integer == 10 ? "October" : integer == 1 ? "November" : "December"
8+
9+
};
10+
11+
12+
console.log(solution(3)); //March
13+
console.log(solution(7)); //July
14+
console.log(solution(9)); //September

‎problem-42.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Take an integeras input and print it's multiplication
2+
// table up to 10. if user gives 5 your output shouold look like the following example.
3+
4+
// 5 * 1 = 5 5 * 2 = 10 5 * 3 = 15 5 * 10 = 50
5+
6+
const solution = (integer)=> {
7+
let sum = ''
8+
for (let i = 1 ; i <= 10 ; i++){
9+
sum+=` ${integer} * ${i} = ${integer * i} `
10+
}
11+
12+
return sum;
13+
};
14+
15+
16+
17+
console.log(solution(5))// Multiplication Table of 5
18+
console.log(solution(6))// Multiplication Table of 6
19+
console.log(solution(7))// Multiplication Table of 7

0 commit comments

Comments
(0)

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