-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidation.js
More file actions
36 lines (27 loc) · 711 Bytes
/
validation.js
File metadata and controls
36 lines (27 loc) · 711 Bytes
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
/**
* concept : check perfect parameters value like number or string
*
* if parameters value isn't valid show a message
*/
function sum(a, b){
if(typeof a!== 'number' || typeof b!== 'number'){
return 'Please return a valid numbers. 🙂'
}
else{
const total = a + b;
return total;
}
}
const result = sum(4,'t');
// console.log(result);
function fullName(firstrName, lastName){
if (typeof firstrName !== 'string' || typeof lastName !== 'string') {
return "Please Enter a valid Name."
}
else{
const fullName = firstrName + ' ' + lastName;
return fullName;
}
}
const output = fullName('mehedi', 5);
console.log(output);