From 71b9dd6cefd2e97c97e3ce411ec651f530562f14 Mon Sep 17 00:00:00 2001
From: Aymane Ismail <aymane.ismail.etu@univ-lille.fr>
Date: Fri, 28 Jan 2022 11:55:43 +0100
Subject: [PATCH] Moitie G
---
index.html | 2 +-
src/main.js | 20 +++++++++++++++++---
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/index.html b/index.html
index 167dc0e..d99bcf6 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 739e636..c89d046 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;
}
--
GitLab