Bonjour � tous,

je me lance doucement en Javascript. Pour ceci, j'ai cod� un petit jeu d'anagramme. J'aimerais si quelqu'un avait le temps des critiques et conseils pour �viter de futures erreurs.

voici mon jeu (en mode console) :

Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
 
<!DOCTYPE html>
<html>
<head lang="fr">
    <meta charset="UTF-8">
    <title>Jeu Anagramme</title>
 
        <script type="application/javascript">
 
        function anagramme() {
 
            var tabMot, motChoisi, tabAleatoire, tabChoixUtilsateur;
 
            tabMot = [
                ["champignon", "cham", "pi", "gnon"],
                ["parapluie", "pa", "ra", "pluie"],
                ["telephone", "te", "le", "pho", "ne"]
            ];
 
            motChoisi = Math.floor((Math.random() * tabMot.length));
            tabAleatoire = new Array();
            tabChoixUtilsateur = new Array();
 
 
            //creation et melange du tableau avec le mot choisi
            function melangeMot (){
 
                console.log("mot choisi : " + tabMot[motChoisi][0]);
 
                for (i = 1; i < tabMot[motChoisi].length; i++){
 
                    tabAleatoire.push(tabMot[motChoisi][i]);
 
                }   
                console.log(tabAleatoire);
 
                // Creation de l'anagramme, mélange du tableau
 
                for(var position=tabAleatoire.length-1; position>=1; position--){
 
                //hasard reçoit un nombre entier aléatoire entre 0 et position
                var hasard=Math.floor(Math.random()*(position+1));
 
                //Echange
                var sauve=tabAleatoire[position];
                tabAleatoire[position]=tabAleatoire[hasard];
                tabAleatoire[hasard]=sauve;
                } 
                for(var i = 0; i < tabAleatoire.length; i++){
                                console.log(tabAleatoire[i] + " " + (i + 1) );
                            } 
            };
 
 
            melangeMot();
 
         	//Input de l'utilisateur 
            function utilisateur(){
 
         		for(var i = 0, length1 = tabAleatoire.length; i < length1; i++){
         			var reponse = prompt("syllabe " + (i + 1) + " : ");
                    console.log(reponse);
                    var tmp = tabAleatoire[reponse - 1];
         			tabChoixUtilsateur.push(tmp);
 
         		}
         		console.log("choix utilisateur : " + tabChoixUtilsateur);
         	}
         	utilisateur();
 
 
            function compareTab()
                {
                    if (tabChoixUtilsateur.length != tabMot[motChoisi].length - 1) {
                        console.log('longueur différente');
                    } else {
                        for (var i = 0; i < tabChoixUtilsateur.length; ++i) {
                            if (tabChoixUtilsateur[i] != tabMot[motChoisi][i + 1]) {
                                // Affichage des erreurs ...
                                console.log("bonne syllabe : " + tabMot[motChoisi][i + 1]);
                                console.log("syllabe choisi : " + tabChoixUtilsateur[i]);
                                console.log('Attention !!!');
                            } else {
                                console.log('C\'est parfait !!!');
                            }
                        } 
                    } 
                }
            compareTab();
        };
        anagramme();
 
    </script>
 
</head>
 
<body>
 
 
 
</body>
</html>
les moindres r�flexions me seront utiles, merci d'avance.
bises � tous