diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
index c1a2632741d..31132976ca3 100644
--- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
+++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
@@ -8,23 +8,28 @@ dashedName: iterate-through-the-keys-of-an-object-with-a-for---in-statement
# --description--
-في بعض الأحيان قد تحتاج إلى المرور علي جميع keys داخل object. يتطلب هذه صياغة محددة في JavaScript تسمى for...in. بالنسبة إلى object باسم `users`، يمكن أن يبدو هذا كالتالي:
+Sometimes you need to iterate through all the keys within an object. You can use a for...in loop to do this. The for...in loop looks like:
-```js
-for (let user in users) {
- console.log(user);
+```javascript
+const refrigerator = {
+ 'milk': 1,
+ 'eggs': 12,
+};
+
+for (const food in refrigerator) {
+ console.log(food, refrigerator[food]);
}
```
-سيؤدي هذا إلى تسجيل `Alan`, و `Jeff`, و `Sarah` - كل قيمة على سطرها الخاص.
+This code logs `milk 1` and `eggs 12`, with each key-value pair on its own line.
-في هذه العبارة حددت متغيرًا `user`، وكما ترى, تمت إعادة تعيين هذا المتغير خلال كل دورة لكل key من keys في object، مما أدى إلى ظهور اسم كل مستخدم مطبوع في وحدة التحكم.
+We defined the variable `food` in the loop head and this variable was set to each of the object's keys on each iteration, resulting in each food's name being printed to the console.
**ملاحظة:** لا تحتفظ كائن (objects) بترتيب هُوِيَّات (keys) المخزنة مثل قوائم (arrays)؛ لذا فإنّ مكان الهُوِيَّة (key) على كائن (object) ما، أو الترتيب النسبي الذي يظهر به، لا يهم عند الإشارة إلى تلك الهُوِيَّة (key) أو الوصول إليه.
# --instructions--
-لقد حددنا وظيفة `countOnline` التي تقبل حجة (argument) واحدة (وهي users object). استخدم for...in داخل هذه الوظيفة (function) للمرور بتكرار علي users object الذي تم تمريره في (function) وإنتاج عدد المستخدمين الذين تم تعيين خاصية `online` الخاصة بهم إلى `true`. مثال على users object الذي يمكن تمريره إلى `countOnline` يظهر أدناه. سيكون لكل مستخدم خاصية `online` بقيمة `true` أو `false`.
+We've defined a function `countOnline` which accepts one argument, `allUsers`. Use a for...in statement inside this function to loop through the `allUsers` object and return the number of users whose online property is set to `true`. An example of an object which could be passed to `countOnline` is shown below. Each user will have an `online` property set to either `true` or `false`.
```js
{
@@ -128,7 +133,7 @@ const users = {
}
}
-function countOnline(usersObj) {
+function countOnline(allUsers) {
// Only change code below this line
// Only change code above this line
@@ -140,13 +145,13 @@ console.log(countOnline(users));
# --solutions--
```js
-function countOnline(usersObj) {
- let online = 0;
- for(let user in usersObj){
- if(usersObj[user].online) {
- online++;
+function countOnline(allUsers) {
+ let numOnline = 0;
+ for(const user in allUsers){
+ if(allUsers[user].online) {
+ numOnline++;
}
}
- return online;
+ return numOnline;
}
```
diff --git a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
index 88f783a5d99..abd643841ae 100644
--- a/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
+++ b/curriculum/challenges/arabic/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
@@ -8,25 +8,24 @@ dashedName: testing-objects-for-properties
# --description--
-في بعض الأحيان يكون من المفيد التحقق مما إذا كانت خاصية كائن (object property) معين موجودة أم لا. يمكننا استخدام وظيفة `.hasOwnProperty(propname)` لتحديد ما إذا كان لهذا الكائن اسم خاصية معين. يرجع `.hasOwnProperty()` حالة `true` أو `false` إذا تم العثور على الخاصية أو لا.
+To check if a property on a given object exists or not, you can use the `.hasOwnProperty()` method. `someObject.hasOwnProperty(someProperty)` returns `true` or `false` depending on if the property is found on the object or not.
**مثال**
```js
-const myObj = {
- top: "hat",
- bottom: "pants"
-};
+function checkForProperty(object, property) {
+ return object.hasOwnProperty(property);
+}
-myObj.hasOwnProperty("top");
-myObj.hasOwnProperty("middle");
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'top'); // true
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'middle'); // false
```
-يرجع أول `hasOwnProperty` حالة `true`، في حين أن يرجع الثاني `false`.
+The first `checkForProperty` function call returns `true`, while the second returns `false`.
# --instructions--
-عدّل الوظيفة `checkObj` لاختبار ما إذا كان كائن تم تمريره إلى الوظيفة (`obj`) يحتوي على خاصية محددة (`checkProp`). إذا تم العثور على الخاصية، قم إرجاع قيمة تلك الخاصية. إذا لم يكن الأمر كذلك، قم إرجاع `"Not Found"`.
+Modify the function `checkObj` to test if the object passed to the function parameter `obj` contains the specific property passed to the function parameter `checkProp`. If the property passed to `checkProp` is found on `obj`, return that property's value. If not, return `Not Found`.
# --hints--
diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
index c6238b203be..8e2d1215c15 100644
--- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
+++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
@@ -8,23 +8,28 @@ dashedName: iterate-through-the-keys-of-an-object-with-a-for---in-statement
# --description--
-如果我們想要遍歷對象中的所有屬性, 只需要使用 JavaScript 中的 for...in 語句即可。 以遍歷 `users` 對象的屬性爲例:
+Sometimes you need to iterate through all the keys within an object. You can use a for...in loop to do this. The for...in loop looks like:
-```js
-for (let user in users) {
- console.log(user);
+```javascript
+const refrigerator = {
+ 'milk': 1,
+ 'eggs': 12,
+};
+
+for (const food in refrigerator) {
+ console.log(food, refrigerator[food]);
}
```
-這將記錄 `Alan`、`Jeff` 和 `Sarah` - 每個值都在自己的行中。
+This code logs `milk 1` and `eggs 12`, with each key-value pair on its own line.
-在上面的代碼中,我們定義了一個 `user` 變量。 可以觀察到,這個變量在遍歷對象的語句執行過程中會一直被重置並賦予新值,結果就是不同的用戶名打印到了 console 中。
+We defined the variable `food` in the loop head and this variable was set to each of the object's keys on each iteration, resulting in each food's name being printed to the console.
**注意:**對象中的鍵是無序的,這與數組不同。 因此,一個對象中某個屬性的位置,或者說它出現的相對順序,在引用或訪問該屬性時是不確定的。
# --instructions--
-我們已經定義了一個 `countOnline` 函數,它接收一個 users 對象參數。 請在其中使用 for...in 語句來遍歷傳入函數的 users 對象中的用戶,並返回 `online` 屬性爲 `true` 的用戶數量。 以下是一個傳入 `countOnline` 函數的對象示例, 注意每個用戶都有 `online` 屬性,其屬性值爲 `true` 或 `false`:
+We've defined a function `countOnline` which accepts one argument, `allUsers`. Use a for...in statement inside this function to loop through the `allUsers` object and return the number of users whose online property is set to `true`. An example of an object which could be passed to `countOnline` is shown below. Each user will have an `online` property set to either `true` or `false`.
```js
{
@@ -128,7 +133,7 @@ const users = {
}
}
-function countOnline(usersObj) {
+function countOnline(allUsers) {
// Only change code below this line
// Only change code above this line
@@ -140,13 +145,13 @@ console.log(countOnline(users));
# --solutions--
```js
-function countOnline(usersObj) {
- let online = 0;
- for(let user in usersObj){
- if(usersObj[user].online) {
- online++;
+function countOnline(allUsers) {
+ let numOnline = 0;
+ for(const user in allUsers){
+ if(allUsers[user].online) {
+ numOnline++;
}
}
- return online;
+ return numOnline;
}
```
diff --git a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
index 33d21dcdec6..6b83efa715a 100644
--- a/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
+++ b/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
@@ -8,25 +8,24 @@ dashedName: testing-objects-for-properties
# --description--
-有時檢查一個對象屬性是否存在是非常有用的。 我們可以用對象的 `.hasOwnProperty(propname)` 方法來檢查對象是否有指定的屬性。 `.hasOwnProperty()` 找到該屬性時返回 `true`,找不到該屬性時返回 `false`。
+To check if a property on a given object exists or not, you can use the `.hasOwnProperty()` method. `someObject.hasOwnProperty(someProperty)` returns `true` or `false` depending on if the property is found on the object or not.
**示例**
```js
-const myObj = {
- top: "hat",
- bottom: "pants"
-};
+function checkForProperty(object, property) {
+ return object.hasOwnProperty(property);
+}
-myObj.hasOwnProperty("top");
-myObj.hasOwnProperty("middle");
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'top'); // true
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'middle'); // false
```
-第一個 `hasOwnProperty` 返回 `true`,第二個返回 `false`。
+The first `checkForProperty` function call returns `true`, while the second returns `false`.
# --instructions--
-修改函數 `checkObj` 檢查 `obj` 是否有 `checkProp` 屬性。 如果屬性存在,返回屬性對應的值。 如果不存在,返回`"Not Found"`。
+Modify the function `checkObj` to test if the object passed to the function parameter `obj` contains the specific property passed to the function parameter `checkProp`. If the property passed to `checkProp` is found on `obj`, return that property's value. If not, return `Not Found`.
# --hints--
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
index d4d6a2855a9..f3c119b0b03 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
@@ -8,23 +8,28 @@ dashedName: iterate-through-the-keys-of-an-object-with-a-for---in-statement
# --description--
-如果我们想要遍历对象中的所有属性, 只需要使用 JavaScript 中的 for...in 语句即可。 以遍历 `users` 对象的属性为例:
+Sometimes you need to iterate through all the keys within an object. You can use a for...in loop to do this. The for...in loop looks like:
-```js
-for (let user in users) {
- console.log(user);
+```javascript
+const refrigerator = {
+ 'milk': 1,
+ 'eggs': 12,
+};
+
+for (const food in refrigerator) {
+ console.log(food, refrigerator[food]);
}
```
-这将记录 `Alan`、`Jeff` 和 `Sarah` - 每个值都在自己的行中。
+This code logs `milk 1` and `eggs 12`, with each key-value pair on its own line.
-在上面的代码中,我们定义了一个 `user` 变量。 可以观察到,这个变量在遍历对象的语句执行过程中会一直被重置并赋予新值,结果就是不同的用户名打印到了 console 中。
+We defined the variable `food` in the loop head and this variable was set to each of the object's keys on each iteration, resulting in each food's name being printed to the console.
**注意:**对象中的键是无序的,这与数组不同。 因此,一个对象中某个属性的位置,或者说它出现的相对顺序,在引用或访问该属性时是不确定的。
# --instructions--
-我们已经定义了一个 `countOnline` 函数,它接收一个 users 对象参数。 请在其中使用 for...in 语句来遍历传入函数的 users 对象中的用户,并返回 `online` 属性为 `true` 的用户数量。 以下是一个传入 `countOnline` 函数的对象示例, 注意每个用户都有 `online` 属性,其属性值为 `true` 或 `false`:
+We've defined a function `countOnline` which accepts one argument, `allUsers`. Use a for...in statement inside this function to loop through the `allUsers` object and return the number of users whose online property is set to `true`. An example of an object which could be passed to `countOnline` is shown below. Each user will have an `online` property set to either `true` or `false`.
```js
{
@@ -128,7 +133,7 @@ const users = {
}
}
-function countOnline(usersObj) {
+function countOnline(allUsers) {
// Only change code below this line
// Only change code above this line
@@ -140,13 +145,13 @@ console.log(countOnline(users));
# --solutions--
```js
-function countOnline(usersObj) {
- let online = 0;
- for(let user in usersObj){
- if(usersObj[user].online) {
- online++;
+function countOnline(allUsers) {
+ let numOnline = 0;
+ for(const user in allUsers){
+ if(allUsers[user].online) {
+ numOnline++;
}
}
- return online;
+ return numOnline;
}
```
diff --git a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
index 9399256427b..4728dbe55f2 100644
--- a/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
+++ b/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
@@ -8,25 +8,24 @@ dashedName: testing-objects-for-properties
# --description--
-有时检查一个对象属性是否存在是非常有用的。 我们可以用对象的 `.hasOwnProperty(propname)` 方法来检查对象是否有指定的属性。 `.hasOwnProperty()` 找到该属性时返回 `true`,找不到该属性时返回 `false`。
+To check if a property on a given object exists or not, you can use the `.hasOwnProperty()` method. `someObject.hasOwnProperty(someProperty)` returns `true` or `false` depending on if the property is found on the object or not.
**示例**
```js
-const myObj = {
- top: "hat",
- bottom: "pants"
-};
+function checkForProperty(object, property) {
+ return object.hasOwnProperty(property);
+}
-myObj.hasOwnProperty("top");
-myObj.hasOwnProperty("middle");
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'top'); // true
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'middle'); // false
```
-第一个 `hasOwnProperty` 返回 `true`,第二个返回 `false`。
+The first `checkForProperty` function call returns `true`, while the second returns `false`.
# --instructions--
-修改函数 `checkObj` 检查 `obj` 是否有 `checkProp` 属性。 如果属性存在,返回属性对应的值。 如果不存在,返回`"Not Found"`。
+Modify the function `checkObj` to test if the object passed to the function parameter `obj` contains the specific property passed to the function parameter `checkProp`. If the property passed to `checkProp` is found on `obj`, return that property's value. If not, return `Not Found`.
# --hints--
diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
index 9400d309b6f..7f9090236e6 100644
--- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
+++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
@@ -8,23 +8,28 @@ dashedName: iterate-through-the-keys-of-an-object-with-a-for---in-statement
# --description--
-A veces es necesario iterar por todas las claves de un objeto. Esto requiere una sintaxis específica en JavaScript llamada sentencia for...in. Para nuestro objeto `users`, esto podría verse así:
+Sometimes you need to iterate through all the keys within an object. You can use a for...in loop to do this. The for...in loop looks like:
-```js
-for (let user in users) {
- console.log(user);
+```javascript
+const refrigerator = {
+ 'milk': 1,
+ 'eggs': 12,
+};
+
+for (const food in refrigerator) {
+ console.log(food, refrigerator[food]);
}
```
-Esto devolvería `Alan`, `Jeff`, y `Sarah` - cada valor en su propia línea.
+This code logs `milk 1` and `eggs 12`, with each key-value pair on its own line.
-En esta sentencia, definimos una variable `user`, y como puedes ver, esta variable se restablece durante cada iteración a cada una de las claves del objeto a medida que la sentencia hace un bucle a través del objeto, dando como resultado que el nombre de cada usuario se imprima en la consola.
+We defined the variable `food` in the loop head and this variable was set to each of the object's keys on each iteration, resulting in each food's name being printed to the console.
**NOTA:** Los objetos no mantienen un orden para las claves almacenadas como lo hacen los arreglos; por lo tanto, la posición de una clave en un objeto, o el orden relativo en el que aparece, es irrelevante cuando se hace referencia o se accede a esa clave.
# --instructions--
-Hemos definido una función `countOnline` que acepta un argumento (un objeto usuario). Utiliza una sentencia for...in dentro de esta función para iterar sobre el objeto usuarios (users) pasado a la función y devuelve el número de usuarios cuya propiedad `online` esté establecida como `true`. A continuación se muestra un ejemplo de un objeto usuario que podría pasarse a `countOnline`. Cada usuario tendrá una propiedad `online` con un valor `true` o `false`.
+We've defined a function `countOnline` which accepts one argument, `allUsers`. Use a for...in statement inside this function to loop through the `allUsers` object and return the number of users whose online property is set to `true`. An example of an object which could be passed to `countOnline` is shown below. Each user will have an `online` property set to either `true` or `false`.
```js
{
@@ -128,7 +133,7 @@ const users = {
}
}
-function countOnline(usersObj) {
+function countOnline(allUsers) {
// Only change code below this line
// Only change code above this line
@@ -140,13 +145,13 @@ console.log(countOnline(users));
# --solutions--
```js
-function countOnline(usersObj) {
- let online = 0;
- for(let user in usersObj){
- if(usersObj[user].online) {
- online++;
+function countOnline(allUsers) {
+ let numOnline = 0;
+ for(const user in allUsers){
+ if(allUsers[user].online) {
+ numOnline++;
}
}
- return online;
+ return numOnline;
}
```
diff --git a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
index 43f63724a0c..4e9e5739669 100644
--- a/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
+++ b/curriculum/challenges/espanol/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
@@ -8,25 +8,24 @@ dashedName: testing-objects-for-properties
# --description--
-A veces es útil comprobar si existe o no la propiedad de un objeto dado. Podemos utilizar el método `.hasOwnProperty(propname)` para determinar si un objeto tiene una propiedad con ese nombre. `.hasOwnProperty()` devuelve `true` o `false` si se encuentra la propiedad o no.
+To check if a property on a given object exists or not, you can use the `.hasOwnProperty()` method. `someObject.hasOwnProperty(someProperty)` returns `true` or `false` depending on if the property is found on the object or not.
**Por ejemplo**
```js
-const myObj = {
- top: "hat",
- bottom: "pants"
-};
+function checkForProperty(object, property) {
+ return object.hasOwnProperty(property);
+}
-myObj.hasOwnProperty("top");
-myObj.hasOwnProperty("middle");
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'top'); // true
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'middle'); // false
```
-El primer `hasOwnProperty` devuelve `true`, mientras que el segundo devuelve `false`.
+The first `checkForProperty` function call returns `true`, while the second returns `false`.
# --instructions--
-Modifica la función `checkObj` para verificar si el objeto `obj` pasado a la función contiene la propiedad `checkProp`. Si la propiedad es encontrada, devuelve el valor de la propiedad. Si no, devuelve `"Not Found"`.
+Modify the function `checkObj` to test if the object passed to the function parameter `obj` contains the specific property passed to the function parameter `checkProp`. If the property passed to `checkProp` is found on `obj`, return that property's value. If not, return `Not Found`.
# --hints--
diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
index d740fdd5a88..acc0349d621 100644
--- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
+++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
@@ -8,23 +8,28 @@ dashedName: iterate-through-the-keys-of-an-object-with-a-for---in-statement
# --description--
-Manchmal musst du alle Schlüssel innerhalb eines Objekts durchlaufen. Das erfordert eine spezielle Syntax in JavaScript, die for...in-Anweisung genannt wird. Für unser `users` Objekt könnte es so aussehen:
+Sometimes you need to iterate through all the keys within an object. You can use a for...in loop to do this. The for...in loop looks like:
-```js
-for (let user in users) {
- console.log(user);
+```javascript
+const refrigerator = {
+ 'milk': 1,
+ 'eggs': 12,
+};
+
+for (const food in refrigerator) {
+ console.log(food, refrigerator[food]);
}
```
-Das würde `Alan`, `Jeff` und `Sarah` protokollieren - jeder Wert in einer eigenen Zeile.
+This code logs `milk 1` and `eggs 12`, with each key-value pair on its own line.
-In dieser Anweisung haben wir eine Variable `user` definiert, und wie du sehen kannst, wurde diese Variable bei jeder Iteration auf jeden der Schlüssel des Objekts zurückgesetzt, während die Anweisung das Objekt in einer Schleife durchlief, was dazu führte, dass der Name jedes Benutzers auf der Konsole ausgegeben wurde.
+We defined the variable `food` in the loop head and this variable was set to each of the object's keys on each iteration, resulting in each food's name being printed to the console.
**HINWEIS:** Objekte behalten keine Reihenfolge der gespeicherten Schlüssel bei, wie es bei Arrays der Fall ist; daher ist die Position eines Schlüssels auf einem Objekt oder die relative Reihenfolge, in der er erscheint, irrelevant, wenn auf diesen Schlüssel verwiesen oder zugegriffen wird.
# --instructions--
-Wir haben eine Funktion `countOnline` definiert, die ein Argument (ein Nutzer-Objekt) akzeptiert. Nutze eine for...in Anweisung innerhalb dieser Funktion, um eine Schleife durch das an die Funktion übergebene Benutzerobjekt zu durchlaufen und die Anzahl der Nutzer zurückzugeben, deren `online` Eigenschaft auf `true` festgesetzt ist. Ein Beispiel für ein Benutzerobjekt, das an `countOnline` übergeben werden könnte, wird unten gezeigt. Jeder Nutzer wird eine `online` Eigenschaft mit entweder einem `true` oder `false` Wert besitzen.
+We've defined a function `countOnline` which accepts one argument, `allUsers`. Use a for...in statement inside this function to loop through the `allUsers` object and return the number of users whose online property is set to `true`. An example of an object which could be passed to `countOnline` is shown below. Each user will have an `online` property set to either `true` or `false`.
```js
{
@@ -128,7 +133,7 @@ const users = {
}
}
-function countOnline(usersObj) {
+function countOnline(allUsers) {
// Only change code below this line
// Only change code above this line
@@ -140,13 +145,13 @@ console.log(countOnline(users));
# --solutions--
```js
-function countOnline(usersObj) {
- let online = 0;
- for(let user in usersObj){
- if(usersObj[user].online) {
- online++;
+function countOnline(allUsers) {
+ let numOnline = 0;
+ for(const user in allUsers){
+ if(allUsers[user].online) {
+ numOnline++;
}
}
- return online;
+ return numOnline;
}
```
diff --git a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
index 797af310ee7..26fab336862 100644
--- a/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
+++ b/curriculum/challenges/german/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
@@ -8,25 +8,24 @@ dashedName: testing-objects-for-properties
# --description--
-Manchmal ist es nützlich zu prüfen, ob die Eigenschaft eines bestimmten Objekts existiert oder nicht. Wir können die Methode `.hasOwnProperty(propname)` von Objekten verwenden, um festzustellen, ob das Objekt den angegebenen Eigenschaftsnamen enthält. `.hasOwnProperty()` gibt `true` oder `false` zurück, wenn die Eigenschaft gefunden wird oder nicht.
+To check if a property on a given object exists or not, you can use the `.hasOwnProperty()` method. `someObject.hasOwnProperty(someProperty)` returns `true` or `false` depending on if the property is found on the object or not.
**Beispiel**
```js
-const myObj = {
- top: "hat",
- bottom: "pants"
-};
+function checkForProperty(object, property) {
+ return object.hasOwnProperty(property);
+}
-myObj.hasOwnProperty("top");
-myObj.hasOwnProperty("middle");
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'top'); // true
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'middle'); // false
```
-Die erste `hasOwnProperty` gibt `true` zurück, während die zweite `false` zurückgibt.
+The first `checkForProperty` function call returns `true`, while the second returns `false`.
# --instructions--
-Ändere die Funktion `checkObj` so, dass sie prüft, ob ein an die Funktion übergebenes Objekt (`obj`) eine bestimmte Eigenschaft enthält (`checkProp`). Wenn die Eigenschaft gefunden wird, wird der Wert der Eigenschaft zurückgegeben. Wenn nicht, wird `"Not Found"` zurückgegeben.
+Modify the function `checkObj` to test if the object passed to the function parameter `obj` contains the specific property passed to the function parameter `checkProp`. If the property passed to `checkProp` is found on `obj`, return that property's value. If not, return `Not Found`.
# --hints--
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
index ebcc0a832ed..3e17725fc96 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
@@ -8,23 +8,28 @@ dashedName: iterate-through-the-keys-of-an-object-with-a-for---in-statement
# --description--
-A volte potrebbe essere necessario iterare attraverso tutte le chiavi di un oggetto. Ciò richiede una sintassi specifica in JavaScript chiamata istruzione for...in. Per il nostro oggetto `users`, questo potrebbe assomigliare a:
+Sometimes you need to iterate through all the keys within an object. You can use a for...in loop to do this. The for...in loop looks like:
-```js
-for (let user in users) {
- console.log(user);
+```javascript
+const refrigerator = {
+ 'milk': 1,
+ 'eggs': 12,
+};
+
+for (const food in refrigerator) {
+ console.log(food, refrigerator[food]);
}
```
-Che scriverebbe `Alan`, `Jeff` e `Sarah` sulla console - ogni valore sulla propria riga.
+This code logs `milk 1` and `eggs 12`, with each key-value pair on its own line.
-In questa dichiarazione abbiamo definito una variabile `user`, e come puoi vedere, mentre l'iterazione prosegue attraverso l'oggetto, ad ogni ripetizione la variabile viene reimpostata a ciascuna delle chiavi, risultando nella stampa del nome di ogni utente sulla console.
+We defined the variable `food` in the loop head and this variable was set to each of the object's keys on each iteration, resulting in each food's name being printed to the console.
**NOTA:** Gli oggetti non mantengono un ordine sulle chiavi memorizzate come fanno gli arrays; di conseguenza la posizione di una chiave in un oggetto, o l'ordine relativo in cui appare, è irrilevante quando ci si riferisce a tale chiave o vi si accede.
# --instructions--
-Abbiamo definito una funzione `countOnline` che accetta un argomento (un oggetto users). Usa un'instruzione for...in all'interno di questa funzione per iterare attraverso l'oggetto users passato alla funzione e restituire il numero di utenti la cui proprietà `online` è impostata a `true`. Un esempio di oggetto users che potrebbe essere passato a `countOnline` è mostrato qui sotto. Ogni utente avrà una proprietà `online` con un valore `true` o `false`.
+We've defined a function `countOnline` which accepts one argument, `allUsers`. Use a for...in statement inside this function to loop through the `allUsers` object and return the number of users whose online property is set to `true`. An example of an object which could be passed to `countOnline` is shown below. Each user will have an `online` property set to either `true` or `false`.
```js
{
@@ -128,7 +133,7 @@ const users = {
}
}
-function countOnline(usersObj) {
+function countOnline(allUsers) {
// Only change code below this line
// Only change code above this line
@@ -140,13 +145,13 @@ console.log(countOnline(users));
# --solutions--
```js
-function countOnline(usersObj) {
- let online = 0;
- for(let user in usersObj){
- if(usersObj[user].online) {
- online++;
+function countOnline(allUsers) {
+ let numOnline = 0;
+ for(const user in allUsers){
+ if(allUsers[user].online) {
+ numOnline++;
}
}
- return online;
+ return numOnline;
}
```
diff --git a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
index 01345fc3967..03572828503 100644
--- a/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
+++ b/curriculum/challenges/italian/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
@@ -8,25 +8,24 @@ dashedName: testing-objects-for-properties
# --description--
-A volte è utile verificare se la proprietà di un dato oggetto esiste o meno. Possiamo usare il metodo `.hasOwnProperty(propname)` degli oggetti per determinare se quell'oggetto ha una proprietà con quel nome. `.hasOwnProperty()` restituisce `true` o `false` se la proprietà viene trovata o meno.
+To check if a property on a given object exists or not, you can use the `.hasOwnProperty()` method. `someObject.hasOwnProperty(someProperty)` returns `true` or `false` depending on if the property is found on the object or not.
**Esempio**
```js
-const myObj = {
- top: "hat",
- bottom: "pants"
-};
+function checkForProperty(object, property) {
+ return object.hasOwnProperty(property);
+}
-myObj.hasOwnProperty("top");
-myObj.hasOwnProperty("middle");
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'top'); // true
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'middle'); // false
```
-Il primo `hasOwnProperty` restituisce `true`, mentre il secondo restituisce `false`.
+The first `checkForProperty` function call returns `true`, while the second returns `false`.
# --instructions--
-Modifica la funzione `checkObj` per verificare se un oggetto passato alla funzione (`obj`) contiene una proprietà specifica (`checkProp`). Se la proprietà viene trovata, restituisci il valore di quella proprietà. In caso contrario, restituisci `"Not Found"`.
+Modify the function `checkObj` to test if the object passed to the function parameter `obj` contains the specific property passed to the function parameter `checkProp`. If the property passed to `checkProp` is found on `obj`, return that property's value. If not, return `Not Found`.
# --hints--
diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-modern-javascript-methods-by-building-football-team-cards/63f29ce62aea65eb041758c8.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-modern-javascript-methods-by-building-football-team-cards/63f29ce62aea65eb041758c8.md
index 869a556d87e..03629444fef 100644
--- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-modern-javascript-methods-by-building-football-team-cards/63f29ce62aea65eb041758c8.md
+++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-modern-javascript-methods-by-building-football-team-cards/63f29ce62aea65eb041758c8.md
@@ -23,7 +23,7 @@ switch (expression) {
}
```
-In this example, the first `case` checks if `expression === 1`, and if so logs `1` to the console. If no cases are true, it will log `Not 1` to the console. The `break` statement stops execution of the `switch` when the `case` is true.
+In questo esempio, il primo `case` controlla se `expression === 1` e, in tal caso, mostra `1` sulla console. Se nessun case è vero, mostrerà `Not 1` sulla console. L'istruzione `break` interrompe l'esecuzione di `switch` quando `case` è true.
Aggiungi un'istruzione `switch` e usa `e.target.value` come espressione.
diff --git a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-regular-expressions-by-building-a-spam-filter/642349b5b7bae31af21cd5f8.md b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-regular-expressions-by-building-a-spam-filter/642349b5b7bae31af21cd5f8.md
index 7972161be61..e7d9a08ddeb 100644
--- a/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-regular-expressions-by-building-a-spam-filter/642349b5b7bae31af21cd5f8.md
+++ b/curriculum/challenges/italian/15-javascript-algorithms-and-data-structures-22/learn-regular-expressions-by-building-a-spam-filter/642349b5b7bae31af21cd5f8.md
@@ -37,7 +37,7 @@ assert.match(dearRegex.source, /\[(i1\||i\|1|1i\||1\|i|\|1i|\|i1)\]/);
assert.match(dearRegex.source, /\(\?:/);
```
-Your `dearRegex` should use a non-capturing group to match `\s` or `^`.
+`dearRegex` dovrebbe usare un gruppo di non acquisizione per trovare `\s` o `^`.
```js
assert.match(dearRegex.source, /\(\?:(\^\|\\s|\\s\|\^)\)/);
diff --git a/curriculum/challenges/italian/16-the-odin-project/top-learn-css-foundations/css-foundations-question-b.md b/curriculum/challenges/italian/16-the-odin-project/top-learn-css-foundations/css-foundations-question-b.md
index b8fa336db64..b631127b2bb 100644
--- a/curriculum/challenges/italian/16-the-odin-project/top-learn-css-foundations/css-foundations-question-b.md
+++ b/curriculum/challenges/italian/16-the-odin-project/top-learn-css-foundations/css-foundations-question-b.md
@@ -63,7 +63,7 @@ Per selezionare una `class` si usa `$` e per selezionare un `id` si usa `#`
---
-To select a `class` you use `.` and to select an `id` you use `*`
+Per selezionare una `class` si usa `.` e per selezionare un `id` si usa `*`
---
diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
index f3fe53808ad..613b3ff8429 100644
--- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
+++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
@@ -8,23 +8,28 @@ dashedName: iterate-through-the-keys-of-an-object-with-a-for---in-statement
# --description--
-オブジェクト内のすべてのキーの繰り返し処理を必要とする場合があります。 これには、for...in ステートメントと呼ばれる JavaScript 固有の構文が必要になります。 `users` オブジェクトの場合は次のように記述できます。
+Sometimes you need to iterate through all the keys within an object. You can use a for...in loop to do this. The for...in loop looks like:
-```js
-for (let user in users) {
- console.log(user);
+```javascript
+const refrigerator = {
+ 'milk': 1,
+ 'eggs': 12,
+};
+
+for (const food in refrigerator) {
+ console.log(food, refrigerator[food]);
}
```
-これは `Alan`、`Jeff`、`Sarah` の値を、それぞれ別の行に出力します。
+This code logs `milk 1` and `eggs 12`, with each key-value pair on its own line.
-このステートメントでは変数 `user` を定義しました。ご覧のように、for...in ステートメントでオブジェクトがループ処理されるとき、この変数は繰り返し処理ごとにオブジェクトの各キーにリセットされ、それぞれのユーザー名がコンソールに出力されます。
+We defined the variable `food` in the loop head and this variable was set to each of the object's keys on each iteration, resulting in each food's name being printed to the console.
**注:** オブジェクトも配列の場合と同じように、格納されているキーの順序は維持されません。つまり、キーを参照したりキーにアクセスしたりするときは、そのキーのオブジェクト内での位置や、表示される相対的な順序は無関係になります。
# --instructions--
-関数 `countOnline` を定義しました。この関数は 1 つの引数 (ユーザーオブジェクト) を受け取ります。 この関数の中で for...in ステートメントを使用して、関数に渡されたユーザーオブジェクトをループ処理し、`online` プロパティが `true` に設定されているユーザーの数を返してください。 たとえば、`countOnline` には次のようなユーザーオブジェクトが渡されます。 各ユーザーは `true` または `false` のいずれかの値を持つ `online` プロパティを持ちます。
+We've defined a function `countOnline` which accepts one argument, `allUsers`. Use a for...in statement inside this function to loop through the `allUsers` object and return the number of users whose online property is set to `true`. An example of an object which could be passed to `countOnline` is shown below. Each user will have an `online` property set to either `true` or `false`.
```js
{
@@ -128,7 +133,7 @@ const users = {
}
}
-function countOnline(usersObj) {
+function countOnline(allUsers) {
// Only change code below this line
// Only change code above this line
@@ -140,13 +145,13 @@ console.log(countOnline(users));
# --solutions--
```js
-function countOnline(usersObj) {
- let online = 0;
- for(let user in usersObj){
- if(usersObj[user].online) {
- online++;
+function countOnline(allUsers) {
+ let numOnline = 0;
+ for(const user in allUsers){
+ if(allUsers[user].online) {
+ numOnline++;
}
}
- return online;
+ return numOnline;
}
```
diff --git a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
index f01d516d21a..778a1fe54ea 100644
--- a/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
+++ b/curriculum/challenges/japanese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
@@ -8,25 +8,24 @@ dashedName: testing-objects-for-properties
# --description--
-指定されたオブジェクトにプロパティが存在するかどうかをチェックできると便利なことがあります。 オブジェクトの `.hasOwnProperty(propname)` メソッドを使用すると、そのオブジェクトが指定されたプロパティ名を持っているかどうかを確認することができます。 `.hasOwnProperty()` はプロパティの有無に応じて、`true` または `false` を返します。
+To check if a property on a given object exists or not, you can use the `.hasOwnProperty()` method. `someObject.hasOwnProperty(someProperty)` returns `true` or `false` depending on if the property is found on the object or not.
**例**
```js
-const myObj = {
- top: "hat",
- bottom: "pants"
-};
+function checkForProperty(object, property) {
+ return object.hasOwnProperty(property);
+}
-myObj.hasOwnProperty("top");
-myObj.hasOwnProperty("middle");
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'top'); // true
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'middle'); // false
```
-最初の `hasOwnProperty` は `true` を返し、2 つ目は `false` を返します。
+The first `checkForProperty` function call returns `true`, while the second returns `false`.
# --instructions--
-関数に渡されたオブジェクト (`obj`) に特定のプロパティ (`checkProp`) が含まれているかどうかをテストするように、関数 `checkObj` を変更してください。 プロパティが見つかった場合は、そのプロパティの値を返してください。 見つからなかった場合は、`"Not Found"` を返してください。
+Modify the function `checkObj` to test if the object passed to the function parameter `obj` contains the specific property passed to the function parameter `checkProp`. If the property passed to `checkProp` is found on `obj`, return that property's value. If not, return `Not Found`.
# --hints--
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
index 4620b6b034a..47fc59ba910 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
@@ -8,23 +8,28 @@ dashedName: iterate-through-the-keys-of-an-object-with-a-for---in-statement
# --description--
-Às vezes, você pode precisar iterar através de todas as chaves dentro de um objeto. Isso requer uma sintaxe específica no JavaScript chamada de declaração for...in. Para nosso objeto `users`, isso pode se parecer como:
+Sometimes you need to iterate through all the keys within an object. You can use a for...in loop to do this. The for...in loop looks like:
-```js
-for (let user in users) {
- console.log(user);
+```javascript
+const refrigerator = {
+ 'milk': 1,
+ 'eggs': 12,
+};
+
+for (const food in refrigerator) {
+ console.log(food, refrigerator[food]);
}
```
-Isso vai exibir no console `Alan`, `Jeff` e `Sarah` - cada valor em sua própria linha.
+This code logs `milk 1` and `eggs 12`, with each key-value pair on its own line.
-Nessa declaração, definimos uma variável `user` e, como você pode ver, essa variável é redefinida durante cada iteração para cada chave do objeto conforme o comando se repete através do objeto, resultando em cada nome de usuário sendo exibido no console.
+We defined the variable `food` in the loop head and this variable was set to each of the object's keys on each iteration, resulting in each food's name being printed to the console.
**Observação:** objetos não mantém uma ordem para as chaves armazenadas como arrays fazem. Portanto, a posição de uma chave em um objeto, ou a ordem relativa na qual ela aparece, é irrelevante quando referenciando ou acessando aquela chave.
# --instructions--
-Nós definimos uma função `countOnline` a qual aceita um argumento (um objeto users). Use a declaração for...in dentro dessa função para iterar o objeto users passado para a função, e retorne o número de users o qual possuam a propriedade `online` definida como `true`. Um exemplo de um objeto users o qual pode ser passado para `countOnline` é mostrado abaixo. Cada usuário terá a propriedade `online` com um valor `true` ou `false`.
+We've defined a function `countOnline` which accepts one argument, `allUsers`. Use a for...in statement inside this function to loop through the `allUsers` object and return the number of users whose online property is set to `true`. An example of an object which could be passed to `countOnline` is shown below. Each user will have an `online` property set to either `true` or `false`.
```js
{
@@ -128,7 +133,7 @@ const users = {
}
}
-function countOnline(usersObj) {
+function countOnline(allUsers) {
// Only change code below this line
// Only change code above this line
@@ -140,13 +145,13 @@ console.log(countOnline(users));
# --solutions--
```js
-function countOnline(usersObj) {
- let online = 0;
- for(let user in usersObj){
- if(usersObj[user].online) {
- online++;
+function countOnline(allUsers) {
+ let numOnline = 0;
+ for(const user in allUsers){
+ if(allUsers[user].online) {
+ numOnline++;
}
}
- return online;
+ return numOnline;
}
```
diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
index 2c8af2b05e4..ebcfd1bd2ac 100644
--- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
+++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
@@ -8,25 +8,24 @@ dashedName: testing-objects-for-properties
# --description--
-Às vezes, é útil verificar se a propriedade de um determinado objeto existe ou não. Podemos usar o método de objetos `.hasOwnProperty(propname)` para determinar se aquele objeto possui o nome de propriedade fornecido. `.hasOwnProperty()` retorna `true` ou `false` se a propriedade for encontrada ou não.
+To check if a property on a given object exists or not, you can use the `.hasOwnProperty()` method. `someObject.hasOwnProperty(someProperty)` returns `true` or `false` depending on if the property is found on the object or not.
**Exemplo**
```js
-const myObj = {
- top: "hat",
- bottom: "pants"
-};
+function checkForProperty(object, property) {
+ return object.hasOwnProperty(property);
+}
-myObj.hasOwnProperty("top");
-myObj.hasOwnProperty("middle");
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'top'); // true
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'middle'); // false
```
-O primeiro `hasOwnProperty` retorna `true`, enquanto o segundo retorna `false`.
+The first `checkForProperty` function call returns `true`, while the second returns `false`.
# --instructions--
-Modifique a função `checkObj` para verificar se um objeto passado para a função (`obj`) contém uma propriedade específica (`checkProp`). Se a propriedade for encontrada, retorne o valor da propriedade. Se não, retorne `"Not Found"`.
+Modify the function `checkObj` to test if the object passed to the function parameter `obj` contains the specific property passed to the function parameter `checkProp`. If the property passed to `checkProp` is found on `obj`, return that property's value. If not, return `Not Found`.
# --hints--
diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
index da8116f921f..c1945356d1a 100644
--- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
+++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement.md
@@ -8,23 +8,28 @@ dashedName: iterate-through-the-keys-of-an-object-with-a-for---in-statement
# --description--
-Часом вам треба буде ітерувати всі ключі всередині об'єкта. У JavaScript це вимагає певного синтаксису, що називається for...in циклом. Для нашого `users` об'єкту, це може виглядати так:
+Sometimes you need to iterate through all the keys within an object. You can use a for...in loop to do this. The for...in loop looks like:
-```js
-for (let user in users) {
- console.log(user);
+```javascript
+const refrigerator = {
+ 'milk': 1,
+ 'eggs': 12,
+};
+
+for (const food in refrigerator) {
+ console.log(food, refrigerator[food]);
}
```
-Це б зазначило, що `Alan`, `Jeff` та `Sarah` мають кожне значення у власному рядку.
+This code logs `milk 1` and `eggs 12`, with each key-value pair on its own line.
-У цьому циклі ми визначили змінну `user` і, як ви можете побачити, цю змінну скидували під час кожної ітерації ключів об'єкта, в міру зациклювання через об’єкт, що призводить до того, що кожне ім'я користувача друкується на консолі.
+We defined the variable `food` in the loop head and this variable was set to each of the object's keys on each iteration, resulting in each food's name being printed to the console.
**ПРИМІТКА:** об'єкти не зберігають впорядкування ключів так, як це роблять масиви. Таким чином, позиція ключа в об'єкті або відносний його порядок є недоречним, коли ми його відсилаємо або отримуємо до нього доступ.
# --instructions--
-Ми визначили функцію `countOnline`, яка приймає один аргумент (користувацький об'єкт). Використовуйте for...in цикл у межах цієї функції, щоб обробити користувацький об'єкт, який перейшов у функцію, і повернути кількість користувачів, чия `online` властивість установлена на `true`. Приклад користувацького об'єкту, який можна передати до `countOnline`, показано нижче. Кожен користувач матиме `online` властивість з обома `true` або `false` значеннями.
+We've defined a function `countOnline` which accepts one argument, `allUsers`. Use a for...in statement inside this function to loop through the `allUsers` object and return the number of users whose online property is set to `true`. An example of an object which could be passed to `countOnline` is shown below. Each user will have an `online` property set to either `true` or `false`.
```js
{
@@ -128,7 +133,7 @@ const users = {
}
}
-function countOnline(usersObj) {
+function countOnline(allUsers) {
// Only change code below this line
// Only change code above this line
@@ -140,13 +145,13 @@ console.log(countOnline(users));
# --solutions--
```js
-function countOnline(usersObj) {
- let online = 0;
- for(let user in usersObj){
- if(usersObj[user].online) {
- online++;
+function countOnline(allUsers) {
+ let numOnline = 0;
+ for(const user in allUsers){
+ if(allUsers[user].online) {
+ numOnline++;
}
}
- return online;
+ return numOnline;
}
```
diff --git a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
index a4a3a0baa64..83ed563dc62 100644
--- a/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
+++ b/curriculum/challenges/ukrainian/02-javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties.md
@@ -8,25 +8,24 @@ dashedName: testing-objects-for-properties
# --description--
-Іноді потрібно перевіряти, чи об'єкт має певну властивість. Ми можемо використати метод об'єктів `.hasOwnProperty(propname)`, щоб визначити, чи має цей об’єкт задану назву властивості. `.hasOwnProperty()` повертає `true` або `false`, якщо властивість знайдена чи не знайдена.
+To check if a property on a given object exists or not, you can use the `.hasOwnProperty()` method. `someObject.hasOwnProperty(someProperty)` returns `true` or `false` depending on if the property is found on the object or not.
**Приклад**
```js
-const myObj = {
- top: "hat",
- bottom: "pants"
-};
+function checkForProperty(object, property) {
+ return object.hasOwnProperty(property);
+}
-myObj.hasOwnProperty("top");
-myObj.hasOwnProperty("middle");
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'top'); // true
+checkForProperty({ top: 'hat', bottom: 'pants' }, 'middle'); // false
```
-Перший `hasOwnProperty` повертає `true`, а другий повертає `false`.
+The first `checkForProperty` function call returns `true`, while the second returns `false`.
# --instructions--
-Змініть функцію `checkObj` так, щоб вона перевіряла, чи переданий до функції об’єкт (`obj`) містить певну властивість (`checkProp`). Якщо властивість знайдена, поверніть значення властивості. Якщо ні, поверніть `"Not Found"`.
+Modify the function `checkObj` to test if the object passed to the function parameter `obj` contains the specific property passed to the function parameter `checkProp`. If the property passed to `checkProp` is found on `obj`, return that property's value. If not, return `Not Found`.
# --hints--