Lister tout les contacts


#1

Yes i read but i don't understand all code you write


#2

ok post your code again....


#3

It's here
var bob = {
prenom: "Bob"
nom: "Jones"
téléphone: "01 23 45 67 89"
email: "bob.jones@exemple.com"
};

marie var = {
prenom: "Marie"
nom: "Johnson"
téléphone: "02 34 56 78 91"
email: "marie.johnson@exemple.com"
};

contacts var = [bob, marie];

function affichePersonne (personne) {
console.log (personne.prenom + "" + personne.nom);
}

var liste = function () {

var longueurContacts = contacts.length;
for (var i = 0; i }
}

affichePersonne(contacts[i])

#4

thid part

function affichePersonne (personne) {
    console.log (personne.prenom + "" + personne.nom);
}

you should only add the space betwen the "" in the console.log() liek that

console.log (personne.prenom + " " + personne.nom);

#5

ok i'ts my fault i don't read this part


#6

still not working

var bob = {
prenom: "Bob"
nom: "Jones"
téléphone: "01 23 45 67 89"
email: "bob.jones@exemple.com"
};

marie var = {
prenom: "Marie"
nom: "Johnson"
téléphone: "02 34 56 78 91"
email: "marie.johnson@exemple.com"
};

contacts var = [bob, marie];

function affichePersonne (personne) {
console.log (personne.prenom + " " + personne.nom);
}

var liste = function () {

var longueurContacts = contacts.length;
for (var i = 0; i < longueurContacts; i++) {
}
}

affichePersonne(contacts[i])

#7

then inside the for loop you should call the function affichePersonne()

for (var i = 0; i < longueurContacts; i++ )  {
    affichePersonne(contacts[i])
}

#8

DId you passe the lesson?


#9

No, he write (problem with your synthax)
var liste = function () {
var longueurContacts = contacts.length;
for (var i = 0; i < longueurContacts; i++) {
affichePersonne()
}
}


#10

that

contacts var = [bob, marie];

should be

var contacts  = [bob, marie];

this part

affichePersonne()

you should pur inside the calling functon contacts[i] like that

affichePersonne(contacts[i])

#11

inside function i put contacts[i] ?


#12

yes inside the calling function like that

var liste = function () {
    var longueurContacts = contacts.length;
    for (var i = 0; i < longueurContacts; i++) {
        affichePersonne(contacts[i])
    }
}

#13

Ok, sitll not working

var liste = function () {
var longueurContacts = contacts.length;
for (var i = 0; i < longueurContacts; i++) {
affichePersonne(contacts[i])
}
}


#14

this part

var bob = {
prenom: "Bob"
nom: "Jones"
téléphone: "01 23 45 67 89"
email: "bob.jones@exemple.com"
};

marie var = {
prenom: "Marie"
nom: "Johnson"
téléphone: "02 34 56 78 91"
email: "marie.johnson@exemple.com"
};

it missing the , after each proprity inside each object
like that

var bob = {
    prenom: "Bob" ,
    nom: "Jones",
    téléphone: "01 23 45 67 89" ,
    email: "bob.jones@exemple.com" ,
};

the here

marie var = ..

should be

var marie = ..

#15

waouh!!
finally we succed thx very mutch bro


#16

The exercise send me my code is write, but also not valide my code hi say (propriete is not defined) when i'm wrong ?
function recherche (nom) {
var longueurContacts = contacts.length;
for (var i = 0; i < longueurContacts; i++) {
if (propiete[nom] === nom) {
affichePersonne(nom[i]);
}
}
}

recherche("Jones")


#17

this part

if (propiete[nom] === nom) {
    affichePersonne(nom[i]);
}

propiete is not define so you should us contacts then the nom is the argument that should match to the contacts nom so inside the [] you should put the i from the for loop, so it should be lika that

if (contact[i].nom === nom) {
    affichePersonne(contacts[i]);
}

I add the .nom because it should match with the name you will put inside the calling funtion recherche


#18

Did you passe the lesson?


#19

i change the code, the problem the code is right but he send this message propriete is not defined and also accept the code why ?
function recherche (nom) {
var longueurContacts = contacts.length;
for (var i = 0; i < longueurContacts; i++) {
if (contacts[i] === nom) {
affichePersonne(contacts[i]);
}
}
}

recherche(propriete[nom])


#20

here the instruction

5 En bas du fichier, appelez la fonction recherche en lui passant "Jones" comme nom Ă  rechercher