-
Notifications
You must be signed in to change notification settings - Fork 0
/
HardProblemSolve.js
127 lines (89 loc) · 2.77 KB
/
HardProblemSolve.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// feetToInch function work and done!
// const feetToInch = (feet) => {
// const Inch = feet / 12;
// return Inch;
// };
// const feet = 20;
// const feetToInchFunc = feetToInch(feet);
// console.log(feetToInchFunc);
// centimeterToMeter function work and done!
// const centimeterToMeter = (centimeter) => {
// const Meter = centimeter / 100;
// return Meter;
// };
// const centimeter = 100;
// const centimeterToMeterFunc = centimeterToMeter(centimeter);
// console.log(centimeterToMeterFunc);
// const 3 books sumition
// const pageRequirement = (firstBook, secondBook, thirdBook) => {
// const TotalPage = firstBook + secondBook + thirdBook;
// return TotalPage;
// };
// const firstBook = 100;
// const secondBook = 200;
// const thirdBook = 300;
const pageRequirement = (firstBook, secondBook, thirdBook) => {
let firstBookPages = 100;
let secondBookPages = 200;
let thirdBookPages = 300;
let firstBooks = firstBook * firstBookPages;
let secondBooks = secondBook * secondBookPages;
let thirdBooks = thirdBook * thirdBookPages;
const total = firstBooks + secondBooks + thirdBooks;
return total;
};
const pageRequirementFunc = pageRequirement(1, 1, 1);
console.log(pageRequirementFunc);
// const pageRequirementFunc = pageRequirement(firstBook, secondBook, thirdBook);
// console.log("page requirement for",pageRequirementFunc);
// name big length show
// const bestFriend = (names) => {
// let bigCharecter = [0];
// for (const name of names)
// {
// let element = name;
// if (element > bigCharecter)
// {
// bigCharecter = element;
// }
// }
// return bigCharecter;
// };
// const names = ["jakir","kausar","afifars","thend"]
// const bestFriendFunc = bestFriend(names);
// console.log(bestFriendFunc);
// const bestFriend = (names) => {
// let largest = 0;
// let logical;
// for (let name of names)
// {
// let element = name;
// if (element.length > largest)
// {
// let largest = element.length;
// logical = element;
// }
// }
// return logical;
// };
// const names = ["morsalin kausar" , "jamalpur high school" , "jamalpur technical school"]
// const bestFriendFunc = bestFriend(names);
// console.log(bestFriendFunc);
// show positive number
// const onlyPositive = (number) => {
// let positive = [];
// for (let numbers of number)
// {
// if (numbers > 0)
// {
// positive.push(numbers);
// } else
// {
// break;
// }
// }
// return positive;
// };
// const number = [2, 43, 5, 3, 5,-2,-5];
// const onlyPositives = onlyPositive(number)
// console.log(onlyPositives);