diff --git a/i18n/zh-cn.json b/i18n/zh-cn.json index 8a9ce439..133a19d3 100644 --- a/i18n/zh-cn.json +++ b/i18n/zh-cn.json @@ -16,6 +16,7 @@ , "LOOPING THROUGH ARRAYS": "依次访问数组中的值" , "OBJECTS": "对象" , "OBJECT PROPERTIES": "对象的属性" + , "OBJECT KEYS": "对象的键" , "FUNCTIONS": "函数" , "FUNCTION ARGUMENTS": "函数的参数" , "SCOPE": "作用域" diff --git a/i18n/zh-tw.json b/i18n/zh-tw.json index 26d244b7..a9300c41 100644 --- a/i18n/zh-tw.json +++ b/i18n/zh-tw.json @@ -16,6 +16,7 @@ , "LOOPING THROUGH ARRAYS": "以迴圈存取陣列中的值" , "OBJECTS": "物件" , "OBJECT PROPERTIES": "物件的屬性" + , "OBJECT KEYS": "物件的鍵" , "FUNCTIONS": "函式" , "FUNCTION ARGUMENTS": "函式的參數" , "SCOPE": "作用域" diff --git a/problems/object-keys/problem_zh-cn.md b/problems/object-keys/problem_zh-cn.md index 1b07c63f..8c0d2869 100644 --- a/problems/object-keys/problem_zh-cn.md +++ b/problems/object-keys/problem_zh-cn.md @@ -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 = { @@ -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 = { @@ -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 diff --git a/problems/object-keys/problem_zh-tw.md b/problems/object-keys/problem_zh-tw.md index 1b07c63f..d06e7e83 100644 --- a/problems/object-keys/problem_zh-tw.md +++ b/problems/object-keys/problem_zh-tw.md @@ -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 = { @@ -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 = { @@ -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 diff --git a/problems/object-keys/solution_zh-cn.md b/problems/object-keys/solution_zh-cn.md index 0f3540ea..4e21cd39 100644 --- a/problems/object-keys/solution_zh-cn.md +++ b/problems/object-keys/solution_zh-cn.md @@ -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` 来选择下一个挑战。 --- diff --git a/problems/object-keys/solution_zh-tw.md b/problems/object-keys/solution_zh-tw.md index 0f3540ea..c18b45e6 100644 --- a/problems/object-keys/solution_zh-tw.md +++ b/problems/object-keys/solution_zh-tw.md @@ -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` 來選擇下一個挑戰。 --- diff --git a/problems/scope/problem_zh-cn.md b/problems/scope/problem_zh-cn.md index f8c2ab4f..074329e8 100644 --- a/problems/scope/problem_zh-cn.md +++ b/problems/scope/problem_zh-cn.md @@ -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 +``` diff --git a/problems/scope/problem_zh-tw.md b/problems/scope/problem_zh-tw.md index d544fd62..f3c4d0a7 100644 --- a/problems/scope/problem_zh-tw.md +++ b/problems/scope/problem_zh-tw.md @@ -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 +```