-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiply.js
More file actions
69 lines (53 loc) · 1.08 KB
/
Copy pathmultiply.js
File metadata and controls
69 lines (53 loc) · 1.08 KB
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
/*function addTwoNumbers(){
let answer = firstNumber + secodNumber;
return answer
}
function multiply(numberOne, numberTwo){
let result = numberOne*numberTwo
return result;
}
//module.exports = multiply
constructuring module.exports = {multiply , addTwoNumbers}
//constructuring module.exports = {multiply , addTwoNumbers}
*/
function addTwoNumbers(firstNumber, secondNumber){
let answer = firstNumber + secondNumber;
return answer
}
function multiply(numberOne, numberTwo){
let result = numberOne*numberTwo
return result;
}
/*const getOddNumbers = (arr) =>{
let newArray = [];
for(element of arr){
if(element %2 != 0){
newArray.push(element);
}
}
return newArray;
}
*/
/*
const getOddNumbers = (arr) =>{
let newArray = [];
for(index in arr){
console.log(index)
if(arr[index] %2 != 0){
newArray[index]= arr[index]
}
}
//return newArray;
}
*/
const getOddNumbers = (arr) =>{
let newArray = [];
count = 0
for(index in arr){
if(arr[index] %2 != 0){
newArray[count++]= arr[index]
}
}
return newArray;
}
module.exports = {multiply , addTwoNumbers ,getOddNumbers};