Profile LookUp help needed

Profile LookUp help needed
0

#1

Guys, can anyone say why is giving undefined while should write property value

function lookUpProfile(firstName, prop){
// Only change code below this line
//console.log(contacts[2].firstName == "Sherlock");
for (var i = 0; i < contacts.length; i++) {
	if (contacts[i].firstName == firstName) {
		//console.log(111);
		for (var a = 0; a < contacts.length; a++) {
			//console.log(contacts[a].prop);
			if (contacts[a].hasOwnProperty(prop)) {
				return console.log(contacts[a].prop); //**HERE

			}
			// else {
			// 	return "No such property";
			// }
		}
	}
	// else {
	// 	return "No such contact";
	// }

}

#2

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.