-
Notifications
You must be signed in to change notification settings - Fork 0
/
FunctionVariationsSyntaxAnalysis.js
64 lines (58 loc) · 1.84 KB
/
FunctionVariationsSyntaxAnalysis.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
//Function Variation Syntax Analysis
// FUNCTION VARIATION 1
// 1. FUNCTION DECLARATION
//Function 1a
function enterFullName(first, middle, second) {
console.log(`Full Name : ${second} , ${middle} , ${first} `);
}
//Function 2a
function enterYourAddress(line1, line2, line3) {
console.log(
`Address Line 1 : ${line1}` +
`Address Line 2 : ${line2}` +
`Address Line 3 ${line3}`
);
}
//Function 3b
function enterYourBirhtDate(date) {
console.log(`Date Format Required 00/00/0000`);
console.log(date);
}
// FUNCTION VARIATION 2
// 2. FUNCTION EXPRESSION
//Function 1b
const enterfullName = function (firstName, middleName, lastName) {
return `Full Name : ${lastName}, ${middleName}, ${firstName}`;
};
//Function 2b
const enterYourAddress = function (line1, line2, line3) {
return (
`Address Line 1: ${line1}` +
`Address Line 2: ${line2}` +
`Address Line 3: ${line3}`
);
};
//Function 3b
const enterYourBirthDate = function (date) {
console.log(`Date Format Required 00/00/0000`);
return `Date Entered : ${date}`;
};
// FUNCTION VARIATION 3
// 3. ArrowFunction
//Function 1c
const enterfullName = (firstName, middleName, lastName) => {
return `Full Name : ${lastName}, ${middleName}, ${firstName}`;
};
//Function 2c
const enterYourAddress = (line1, line2, line3) => {
return (
`Address Line 1: ${line1} ` +
`Address Line 2: ${line2} ` +
`Address Line 3: ${line3}`
);
};
//Function 3c
const enterYourBirthDate = date => {
console.log(`Date Format Required 00/00/0000`);
return `Date Entered : ${date}`;
};