-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
48 lines (38 loc) · 914 Bytes
/
script.js
File metadata and controls
48 lines (38 loc) · 914 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
37
38
39
40
41
42
43
44
45
46
47
48
var database = [];
var firstUser = {
username: "andre1ut",
password: "parola"
};
database.push(firstUser);
var secondUser = {
username: "alex",
password: "masina"
};
database.push(secondUser);
var newsFeed = [
{
user: "Laur",
timeline: "Azi am fost la munca"
},
{
user: "Maria",
timeline: "Azi am fost la mare!!!"
},
{
user: "Marius",
timeline: "Sunt ok"
}
];
var usernamePrompt = prompt("Enter your username: ");
var passwordPrompt = prompt("Enter your password: ");
var check = undefined;
function checkUserPass() {
for(let i=0;i<database.length;i++){
if(usernamePrompt === database[i].username && passwordPrompt === database[i].password){
check = true;
console.log(newsFeed);
}
}
if(check === undefined) alert("Wrong credentials! Try again");
}
checkUserPass();