-
Notifications
You must be signed in to change notification settings - Fork 0
/
project1a.js
41 lines (37 loc) · 1.03 KB
/
project1a.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
const loginDetails = [
{ email: "faizan@pw",
password: "F61926pw" },
{
email: "khan@pw",
password: "K12445pw",
},
{
email: "nemat@pw",
password: "11xypw",
},
{
email:"faizan@pw",
password:`santa`
}
];
function login_page(userEmail, userPassword) {
//Condition 1 Email And Password Both Are match
const conditionmatch = loginDetails.find(
(u)=> u.email === userEmail && u.password === userPassword
);
//Condition 2 Email matched but Password doesn't match
const conditionNotmatchWithPassword = loginDetails.find(
(u) =>u.email === userEmail && u.password !== userPassword
);
if (conditionmatch) {
return "Login Successfull";
} else if (conditionNotmatchWithPassword) {
return "Password Not match";
} else {
return "login failed";
}
}
console.log(login_page("faizan@pw", "F61926pw"));
console.log(login_page("khan@pw", "S125pw"));
console.log(login_page("nematt@pw", "S125pw"));
console.log(login_page("faizan@pw",`santa`));