File tree Expand file tree Collapse file tree 4 files changed +48
-1
lines changed Expand file tree Collapse file tree 4 files changed +48
-1
lines changed Original file line number Diff line number Diff line change 41
41
| Problem - 37 | [ sum of an array] ( https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-37.js ) |
42
42
| Problem - 38 | [ biggest number of an array] ( https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-38.js ) |
43
43
| 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 ) |
44
47
45
- <!-- | Problem - 40 | | -->
48
+ <!-- | Problem - 43 | | -->
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments