6. We Made a Friend : Instructions are not correct to the outcome


See comments in my code.
Instruction 01. : different way of input PHONENUMBER + EMAIL
Instruction 05. : delete function that logs output in the console, i.e. 'search'function

Like with many instructions this quite vague

var bob = {
    firstName: "Bob",
    lastName: "Jones",
    phoneNumber: "(650) 777-7777",
    email: "bob.jones@example.com"
var mary = {
    firstName: "Mary",
    lastName: "Johnson",
    phoneNumber: "(650) 888-8888",
    email: "mary.johnson@example.com"
var contacts = [bob, mary];

function printPerson(person) {
    console.log(person.firstName + " " + person.lastName);
function list() {
	var contactsLength = contacts.length;
	for (var i = 0; i < contactsLength; i++) {
//Instructions say : 0.5 And delete any other function that logs output in the console, i.e 'search' function. So why is thw function below still needed ???
var search = function(lastName) {
    var contactsLength = contacts.length;
    for (var i = 0; i < contactsLength; i++) {
        if(lastName === contacts[i].lastName) {
        } else {
//Why do we have to use a different way of making the third person? Proper way for bob and mary was : firtsName, lastName PHONENUMBER, EMAIL !!!
function add(firstName, lastName, email, phoneNumber) {
    contacts[contacts.length] = {
    firstName: firstName,
    lastName: lastName,
    email: email,
    phoneNumber: phoneNumber,
add("James P.", "Dark", "j.p.dark@example.com", "(666) 666-6666");


objects are unordered? so it doesn't matter if you add phonenumber or email first. You use properties to access them, not indexes. If you want you can swap phonenumber and email

Instructions 5 refers to function calls (which cause the functions to execute), i agree that this is a bit vague


It's not that it's technically wrong or not.
It's the inconsistency in the instructions overall that bothers me.

Also :
If the instructions are : "print this out."
If you try to print this out like this "print this out " it returns an error.
Forgetting to put a 'period' in a print out has made look for the sollution to my perfect code for minutes again and again...
It would be nice if that errors reminds me I have to type in the instructions to the "t" like "there is a grammatical error in your code".
If it can detect it, it can also point it out, right?

that's what I mean with inconsistency and such.


Programming is about so much more then just coding, so its a good thing to question instructions actually.

this one i agree with you. Its annoying. I taught myself the habit of just copying strings from the instructions whenever this was asked

No, not without the help of an AI. There is the thing with programming, there are so many things then can go wrong, its impossible without a massive increase of the codebase

The only way to point it out, would be to make the exercises so tight then only the perfect match gets through. Then you can point out where it goes wrong. But then you never learn to debug


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.