Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isUserValid(username, password) {
- for (var i=0; i < database.length; i++) {
- if (database[i].username === username &&
- database[i].password === password) {
- return true;
- }
- }
- return false;
- }
- function signIn() {
- if (isUserValid(prompt("What's your username?"), prompt("What's your password?"))) {
- console.log(newsfeed);
- } else {
- alert("Sorry, incorrect credentials");
- }
- }
- signIn();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement