-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple.js
More file actions
54 lines (53 loc) · 1.03 KB
/
Copy pathsimple.js
File metadata and controls
54 lines (53 loc) · 1.03 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
const arr=[1, 2, 3, 4, 5];
const doubledArr = arr.map(num => num * 2);
console.log(doubledArr); // Output: [2, 4, 6, 8, 10]
export { doubledArr };
const age1= 25;
if (age1 >= 18) {
console.log("You are an adult.");
} else {
console.log("You are a minor.");
}
// This code checks if the age is 18 or older and logs a message accordingly.
const name1 = "Alice";
const age = 30;
const dob = '10/15/1993';
function sayName(){
console.log("My name is " + name1);
}
//functionto say name
function sayAge(){
console.log("My age is " + age);
}
function sayDOB(){
console.log("My date of birth is " + dob);
}
sayName();
sayAge();
sayDOB();
module.exports = {
sayName,
sayAge,
sayDOB
};
function add(a, b) {
return a + b;
}
function subtract(a, b) {
return a - b;
}
function multiply(a, b) {
return a * b;
}
function divide(a, b) {
if (b === 0) {
return 'Error: Division by zero';
}
return a / b;
}
module.exports = {
add,
subtract,
multiply,
divide
};