From 796fb52421a0026c1e29181d7799e05dd9b14972 Mon Sep 17 00:00:00 2001 From: camperbot Date: Sat, 5 Feb 2022 22:30:51 +0530 Subject: [PATCH] chore(i18n,learn): processed translations (#45027) --- ...pre-filter-json-to-get-the-data-you-need.md | 2 +- .../sorted-union.md | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/curriculum/challenges/japanese/04-data-visualization/json-apis-and-ajax/pre-filter-json-to-get-the-data-you-need.md b/curriculum/challenges/japanese/04-data-visualization/json-apis-and-ajax/pre-filter-json-to-get-the-data-you-need.md index 0db05e57a7..cc30e0c010 100644 --- a/curriculum/challenges/japanese/04-data-visualization/json-apis-and-ajax/pre-filter-json-to-get-the-data-you-need.md +++ b/curriculum/challenges/japanese/04-data-visualization/json-apis-and-ajax/pre-filter-json-to-get-the-data-you-need.md @@ -8,7 +8,7 @@ dashedName: pre-filter-json-to-get-the-data-you-need # --description-- -FreeCodeCamp Cat Photo API から取得した猫の写真をすべてレンダリングしたいわけではない場合、写真をループ処理する前に JSON の事前フィルタリングを行えます。 +freeCodeCamp Cat Photo API から取得した猫の写真をすべてレンダリングしたいわけではない場合、写真をループ処理する前に JSON の事前フィルタリングを行えます。 JSON データが配列に格納されている場合、`filter` メソッドを使用して、`id` キーの値が `1` である猫を除外することができます。 diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sorted-union.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sorted-union.md index 109fbbe840..d11e9c3363 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sorted-union.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/sorted-union.md @@ -45,6 +45,18 @@ assert.deepEqual(uniteUnique([1, 2, 3], [5, 2, 1, 4], [2, 1], [6, 7, 8]), [ ]); ``` +`uniteUnique([1, 3, 2], [5, 4], [5, 6])` deve retornar `[1, 3, 2, 5, 4, 6]`. + +```js +assert.deepEqual(uniteUnique([1, 3, 2], [5, 4], [5, 6]), [1, 3, 2, 5, 4, 6]); +``` + +`uniteUnique([1, 3, 2, 3], [5, 2, 1, 4], [2, 1])` deve retornar `[1, 3, 2, 5, 4]`. + +```js +assert.deepEqual(uniteUnique([1, 3, 2, 3], [5, 2, 1, 4], [2, 1]), [1, 3, 2, 5, 4]); +``` + # --seed-- ## --seed-contents-- @@ -62,7 +74,11 @@ uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]); ```js function uniteUnique(arr) { return [].slice.call(arguments).reduce(function(a, b) { - return [].concat(a, b.filter(function(e) {return a.indexOf(e) === -1;})); + return [].concat( + a, + b.filter(function(e, currentIndex) { + return b.indexOf(e) === currentIndex && a.indexOf(e) === -1; + })); }, []); } ```