-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
47 lines (37 loc) · 1.06 KB
/
index.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
// const hummus = function(factor) {
// const ingredient = function(amount, unit, name) {
// let ingredientAmount = amount * factor;
// if (ingredientAmount > 1) {
// unit += "s";
// }
// console.log(`${ingredientAmount} ${unit} ${name}`);
// };
// ingredient(1, "can", "chickpeas");
// ingredient(0.25, "cup", "tahini");
// ingredient(0.25, "cup", "lemon juice");
// ingredient(1, "clove", "garlic");
// ingredient(2, "tablespoon", "olive oil");
// ingredient(0.5, "teaspoon", "cumin");
// };
// hummus(4);
// the codes to return smallest number...
// let minimum = function(a,b){
// if(a<b){
// return a;
// }else if(b<a){
// return b;
// }else return "a is equal to b";
// }
// console.log(minimum(3,2));
// for (let index = 0; index < listOfNumber.length; index++) {
// const element = listOfNumber[index];
// }
// let listOfNumber =[];
function numFactorial(num){
let value = 1;
for (let i = 1; i <= num; ++i) {
value = value *i;
}
return value;
}
console.log(numFactorial(3));