130. exercise: build facebook

변지영·2021년 12월 9일
0
var database = [
	{
		username: "andrei",
		password: "supersecret"
	}
];

var newsFeed = [
	{
		username: "Bobby",
		timeline: "So tired from all that learning!"
	},
	{
		username: "Sally",
		timeline: "Javascript is soooo cool!"
	}
];

var userNamePrompt = prompt("What's your username?");
var passwordPrompt = prompt("What's your password?");

function signIn(user, pass){
	if (user === database[0].username && 
		pass === database[0].password){
		console.log(newsFeed);
    } else{
    	alert("Sorry, wrong username and password!");
    }
}

var database = [
	{
		username: "andrei",
		password: "supersecret"
	}
];

var newsFeed = [
	{
		username: "Bobby",
		timeline: "So tired from all that learning!"
	},
	{
		username: "Sally",
		timeline: "Javascript is soooo cool!"
	}
];

var userNamePrompt = prompt("What's your username?");
var passwordPrompt = prompt("What's your password?");

function signIn(user, pass){
	if (user === database[0].username && 
		pass === database[0].password){
		console.log(newsFeed);
    } else{
    	alert("Sorry, wrong username and password!");
    }
}


signIn(userNamePrompt, passwordPrompt);
//this line was added.

And then refresh


and then I can see newsFeed

0개의 댓글