Tableaux associatifs en JavaScript
Bonjour les amis,
je voudrais savoir comment je peux travailler avec les tableaux associatif en JavaScript.
Par exemple en PHP, je peux faire:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| <?php
$noteVicent=array(12,13,14);
$noteChristoph=array(12,13,14);
$noteGeorge=array(12,13,14);
//tableau qui contiendra les notes
$tabNote=array(array());
$tabNote[$Vicent]['note']=$noteVicent;
$tabNote[$Christoph]['note']=$noteChristoph;
$tabNote[$George]['note']=$noteGeorge;
?> |
et apres pour recupérer les notes de christophe par exemple , je fais :
Code:
1 2 3 4 5 6
| <?php
$lesNotesDeChristoph=$tabNote[$Christoph]['note'];
foreach($lesNotesDeChristoph as $note){
echo $note;
}
?> |
Est ce que je peux faire ça en JavaScript ?Si oui pourrai-je avoir un exemple
Merci