fix(curriculum): Maintain getMode function consistency in steps 39 - 59 (#62313)

This commit is contained in:
Giftea ☕
2025-09-25 14:56:56 +01:00
committed by GitHub
parent 8a404bface
commit 1a59985a51
21 changed files with 44 additions and 66 deletions

View File

@@ -132,9 +132,8 @@ const getMedian = (array) => {
--fcc-editable-region--
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -140,9 +140,8 @@ const getMedian = (array) => {
--fcc-editable-region--
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -126,9 +126,8 @@ const getMedian = (array) => {
--fcc-editable-region--
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -130,9 +130,8 @@ const getMedian = (array) => {
--fcc-editable-region--
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -132,9 +132,8 @@ const getMedian = (array) => {
--fcc-editable-region--
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -123,9 +123,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -159,9 +159,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -123,9 +123,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -137,9 +137,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -135,9 +135,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -143,9 +143,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -143,9 +143,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -161,9 +161,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -147,9 +147,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -125,9 +125,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -123,9 +123,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -137,9 +137,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -146,9 +146,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -119,9 +119,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -117,9 +117,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}

View File

@@ -125,9 +125,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}
@@ -281,9 +280,8 @@ const getMedian = (array) => {
const getMode = (array) => {
const counts = {};
array.forEach((el) => {
counts[el] = (counts[el] || 0) + 1;
})
array.forEach(el => counts[el] = counts[el] ? counts[el] + 1 : 1);
if (new Set(Object.values(counts)).size === 1) {
return null;
}