diff --git a/index.html b/index.html index 167dc0e67b8383041411519e4c798f03d3a714eb..d99bcf6c399a1bde6f35acf6aa629ca43e2a5811 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@ <link rel="stylesheet" href="css/pizzaList.css"> <link rel="stylesheet" href="css/footer.css"> - <script src="build/main.js" defer></script> + <script src="src/main.js" defer></script> </head> <body> diff --git a/src/main.js b/src/main.js index 739e636be903274f7e61892df7e75b3994922f3b..c89d0464b445cb4920c979bf164465e80ed5ffb1 100644 --- a/src/main.js +++ b/src/main.js @@ -30,7 +30,7 @@ data.forEach(element => { ); */ -const data = [ +let data = [ { name: 'Regina', base: 'tomate', @@ -54,6 +54,22 @@ const data = [ } ]; + + +// trie par nom +data.sort((a, b) => a.name.localeCompare(b.name)) +console.log(data); + +data.sort((a, b) => a.price_small - b.price_small) +console.log(data); + +//data = data.filter(word => word.base == 'tomate' ); + +//data = data.filter(word => word.price_small < 6 ); + +data = data.filter(word => word.name == 2); + + let html=""; data.forEach(element => { @@ -73,8 +89,6 @@ data.forEach(element => { </a> </article>`; - console.log(html); - html += html2; }