Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions i18n/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
, "LOOPING THROUGH ARRAYS": "依次访问数组中的值"
, "OBJECTS": "对象"
, "OBJECT PROPERTIES": "对象的属性"
, "OBJECT KEYS": "对象的键"
, "FUNCTIONS": "函数"
, "FUNCTION ARGUMENTS": "函数的参数"
, "SCOPE": "作用域"
Expand Down
1 change: 1 addition & 0 deletions i18n/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
, "LOOPING THROUGH ARRAYS": "以迴圈存取陣列中的值"
, "OBJECTS": "物件"
, "OBJECT PROPERTIES": "物件的屬性"
, "OBJECT KEYS": "物件的鍵"
, "FUNCTIONS": "函式"
, "FUNCTION ARGUMENTS": "函式的參數"
, "SCOPE": "作用域"
Expand Down
19 changes: 9 additions & 10 deletions problems/object-keys/problem_zh-cn.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
JavaScript provides a native way of listing all the available keys of an object. This can be helpful for looping through all the properties of an object and manipulating their values accordingly.
JavaScript 提供了一种原生的方式,用来列出对象的所有键(keys)。当你需要遍历对象的所有属性并相应地操作它们的值时,这会很有用。

Here's an example of listing all object keys using the **Object.keys()**
prototype method.
下面是一个使用 **Object.keys()** 原型方法来列出对象所有键的例子。

```js
const car = {
Expand All @@ -14,13 +13,13 @@ const keys = Object.keys(car)
console.log(keys)
```

The above code will print an array of strings, where each string is a key in the car object. `['make', 'model', 'year']`
上面的代码会打印一个字符串数组,其中每个字符串都是 car 对象中的一个键。`['make', 'model', 'year']`

## The challenge:
## 挑战任务:

Create a file named `object-keys.js`.
创建一个名为 `object-keys.js` 的文件。

In that file, define a variable named `car` like this:
在该文件中,像这样定义一个名为 `car` 的变量:

```js
const car = {
Expand All @@ -30,14 +29,14 @@ const car = {
}
```

Then define another variable named `keys` like this:
然后像这样定义另一个名为 `keys` 的变量:
```js
const keys = Object.keys(car)
```

Use `console.log()` to print the `keys` variable to the terminal.
使用 `console.log()` `keys` 变量打印到终端。

Check to see if your program is correct by running this command:
通过运行以下命令来检查你的程序是否正确:

```bash
javascripting verify object-keys.js
Expand Down
19 changes: 9 additions & 10 deletions problems/object-keys/problem_zh-tw.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
JavaScript provides a native way of listing all the available keys of an object. This can be helpful for looping through all the properties of an object and manipulating their values accordingly.
JavaScript 提供了一種原生的方式,用來列出物件(object)的所有鍵(keys)。當你需要遍歷物件的所有屬性並據此操作它們的值時,這會很有用。

Here's an example of listing all object keys using the **Object.keys()**
prototype method.
下面是一個使用 **Object.keys()** 原型方法來列出物件所有鍵的範例。

```js
const car = {
Expand All @@ -14,13 +13,13 @@ const keys = Object.keys(car)
console.log(keys)
```

The above code will print an array of strings, where each string is a key in the car object. `['make', 'model', 'year']`
上面的程式碼會印出一個字串陣列,其中每個字串都是 car 物件中的一個鍵。`['make', 'model', 'year']`

## The challenge:
## 挑戰任務:

Create a file named `object-keys.js`.
建立一個名為 `object-keys.js` 的檔案。

In that file, define a variable named `car` like this:
在該檔案中,像這樣定義一個名為 `car` 的變數:

```js
const car = {
Expand All @@ -30,14 +29,14 @@ const car = {
}
```

Then define another variable named `keys` like this:
然後像這樣定義另一個名為 `keys` 的變數:
```js
const keys = Object.keys(car)
```

Use `console.log()` to print the `keys` variable to the terminal.
使用 `console.log()` `keys` 變數印到終端機。

Check to see if your program is correct by running this command:
透過執行以下指令來檢查你的程式是否正確:

```bash
javascripting verify object-keys.js
Expand Down
8 changes: 4 additions & 4 deletions problems/object-keys/solution_zh-cn.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---

# CORRECT.
# 正确!

Good job using the Object.keys() prototype method. Remember to use it when you need to list the keys of an object.
很好,你使用了 Object.keys() 原型方法。当你需要列出对象的键时,记得使用它。

The next challenge is all about **functions**.
下一个挑战是关于 **函数(functions)** 的。

Run `javascripting` in the console to choose the next challenge.
在控制台中运行 `javascripting` 来选择下一个挑战。

---
8 changes: 4 additions & 4 deletions problems/object-keys/solution_zh-tw.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---

# CORRECT.
# 正確!

Good job using the Object.keys() prototype method. Remember to use it when you need to list the keys of an object.
很好,你使用了 Object.keys() 原型方法。當你需要列出物件的鍵時,記得使用它。

The next challenge is all about **functions**.
下一個挑戰是關於 **函式(functions)** 的。

Run `javascripting` in the console to choose the next challenge.
在終端機執行 `javascripting` 來選擇下一個挑戰。

---
6 changes: 6 additions & 0 deletions problems/scope/problem_zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@ const a = 1; const b = 2; const c = 3;
```js
console.log(`a: ${a}, b: ${b}, c: ${c}`);
```

通过运行以下命令检查你的程序是否正确:

```bash
javascripting verify scope.js
```
6 changes: 6 additions & 0 deletions problems/scope/problem_zh-tw.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@ const a = 1; const b = 2; const c = 3;
```js
console.log(`a: ${a}, b: ${b}, c: ${c}`);
```

透過執行以下指令來檢查你的程式是否正確:

```bash
javascripting verify scope.js
```