Skip to content

1-js/02-first-steps/16-javascript-specials#46

Merged
leviding merged 10 commits intojavascript-tutorial:zh-hansfrom
liang-kai:translate
May 14, 2018
Merged

1-js/02-first-steps/16-javascript-specials#46
leviding merged 10 commits intojavascript-tutorial:zh-hansfrom
liang-kai:translate

Conversation

@liang-kai
Copy link
Copy Markdown
Contributor

No description provided.

@leviding
Copy link
Copy Markdown
Member

resolve #16

@leviding
Copy link
Copy Markdown
Member

@liang-kai 下次记得 resolve 一下对应的 issue

@allenlongbaobao
Copy link
Copy Markdown
Contributor

校对认领

@leviding
Copy link
Copy Markdown
Member

@allenlongbaobao ok

@Starriers
Copy link
Copy Markdown
Contributor

@leviding 校对认领

Copy link
Copy Markdown
Contributor

@Starriers Starriers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liang-kai @leviding 问题多多! 先去重看译者教程 然后去学习 md 看看怎么用 看看为什么要空格和换行。如果有需要你改了可以我可以再给你看看!

Statements are delimited with a semicolon:
## 代码结构

语句用分号分隔:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

空一行 不要修改结构 自行修改吧

- `undefined` -- a type with a single value `undefined`, meaning "not assigned",
- `object` and `symbol` -- for complex data structures and unique identifiers, we haven't learnt them yet.
有7种数据类型:
- `number` -- 可以是浮点数,也可以是整数,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

破折号统统用中文的

- `number` -- 可以是浮点数,也可以是整数,
- `string` -- 字符串类型,
- `boolean` -- 逻辑值: `true/false`,
- `null` -- 具有单个值'null'的类型,表示“空”或“不存在”,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下文同理不赘述 空格呢 这是一种格式

```

More in: <info:variables> and <info:types>.
更多信息:<info:variables><info:types>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

和 前后空格

:输出一个`消息`。

All these functions are *modal*, they pause the code execution and prevent the visitor from interacting with the page until he answers.
所有这些函数都会产生模态框,它们会暂停代码执行并阻止访问者与页面交互,直到他响应弹框。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原文有标记,这里加粗


Logical operators
: There are few others, like a comma operator.
其他运算符
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

逻辑运算符

更多信息:<info:operators>, <info:comparison>, <info:logical-operators>。

## Loops
##循环语句
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

空格

- The variable declared in `for(let...)` loop is visible only inside the loop. But we can also omit `let` and reuse an existing variable.
- Directives `break/continue` allow to exit the whole loop/current iteration. Use labels to break nested loops.
- `for(let...)`循环中声明的变量只在循环中可见。但是我们也可以省略`let`并重用现有的变量。
- 指令`break / continue`允许退出整个循环/当前迭代。使用标签来打破嵌套循环。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

两个英文单词不用空格

```

2. Function Expression: the function in the context of an expression
2. 函数表达式:表达式的方式声明函数
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

表达式上下文中的函数

##更多

That was a brief list of JavaScript features. As of now we've studied only basics. Further in the tutorial you'll find more specials and advanced features of JavaScript.
这是JavaScript功能的简要概述。截至目前,我们只研究基础知识。在本教程中,您会发现更多特殊功能和JavaScript高级功能。 No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在本教程中 改为 随着教程的深入

@fanyijihua
Copy link
Copy Markdown

@liang-kai 认真看译者教程,自己修改一遍,再艾特校对者进行校对。请认真学习译者教程。

@allenlongbaobao
Copy link
Copy Markdown
Contributor

@liang-kai @leviding 快来修改呀,我好校对,一直这么挂着,我一天要来看一遍。。

@liang-kai
Copy link
Copy Markdown
Contributor Author

liang-kai commented Apr 26, 2018 via email

@liang-kai
Copy link
Copy Markdown
Contributor Author

@allenlongbaobao @Starriers @fanyijihua 修改了,劳烦再看下

@leviding
Copy link
Copy Markdown
Member

@allenlongbaobao @Starriers 可以继续了哈

Copy link
Copy Markdown
Contributor

@allenlongbaobao allenlongbaobao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我校对到 50 行,问题类型比较多,所以不往下校对了。

  1. 中文引号
  2. 英文前后空格
  3. 标点的全角半角
  4. 语义是否通顺
  5. 译文与原文行数要一致

请译者自行排查一遍
@liang-kai @leviding


Semicolons are not required after code blocks `{...}` and syntax constructs with them like loops:
大多数代码风格指南都认为我们应该在每个语句后面加上分号。
在代码块`{}`之后以及循环语句后不需要使用分号:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

行数不一致

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{} => {...}

```

That's called "automatic semicolon insertion". Sometimes it doesn't work, for instance:
这就是所谓的“自动分号插入”。有时它不起作用,例如:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

引号


More in: <info:structure>.
```
...但即使我们可以在某处添加了“额外”分号,这也不是错误。它会被忽略的。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

引号

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[可以] 去掉语义更加清楚

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「」这个?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对的,可以参考译者教程 => 全角和半角

## 严格模式

To fully enable all features of modern JavaScript, we should start scripts with `"use strict"`.
为了完全启用现代JavaScript的所有功能,我们应该使用`“use strict”`指令。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[“use strict”] => ["use strict"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JavaScript 前后空格

@leviding
Copy link
Copy Markdown
Member

@liang-kai 译文排版需要按照译者教程来,麻烦再按照要求修改一遍吧。

@leviding
Copy link
Copy Markdown
Member

leviding commented May 4, 2018

@Starriers @allenlongbaobao 没校对完可以继续了

@leviding
Copy link
Copy Markdown
Member

leviding commented May 4, 2018

@liang-kai 辛苦了

Copy link
Copy Markdown
Contributor

@Starriers Starriers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liang-kai @leviding 校对完成

该指令必须位于 JavaScript 文件的顶部或函数的开头。

Without `"use strict"`, everything still works, but some features behave in the old-fashion, "compatible" way. We'd generally prefer the modern behavior.
如果没有使用严格模式,所有东西都可以正常工作,但是某些功能的表现方式与旧式「兼容」方式相同。我们通常喜欢更现代的方式。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

都 =》 仍在
功能=》特性

一个合格的变量名可以由以下组成:

- 字符串和数字,但是第一个字符不能是数字。
- 字符`$`和`_`是允许的,用法同字母。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

特殊字符前后空格

- `object` and `symbol` -- for complex data structures and unique identifiers, we haven't learnt them yet.
- `number` —— 可以是浮点数,也可以是整数,
- `string` —— 字符串类型,
- `boolean` —— 逻辑值: `true/false`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

中文标号

- `number` —— 可以是浮点数,也可以是整数,
- `string` —— 字符串类型,
- `boolean` —— 逻辑值: `true/false`,
- `null` —— 具有单个值`null`的类型,表示「空」或「不存在」,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

换成引号 最好 与原文一致

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

第二个 null 前后空格

- `string` —— 字符串类型,
- `boolean` —— 逻辑值: `true/false`,
- `null` —— 具有单个值`null`的类型,表示「空」或「不存在」,
- `undefined` —— 一个具有单个值`undefined`的类型,表示「未分配」,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefine 前后空格


[`alert(message)`](mdn:api/Window/alert)
: Output a `message`.
:输出一个`消息`。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

消息 前面空格

## 运算符

JavaScript supports the following operators:
JavaScript支持以下运算符:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

中英文空格

| - |可以有一个名字,只在函数内部可见|

More: see <info:function-basics>, <info:function-expressions-arrows>.
更多:参见<info:function-basics>, <info:function-expressions-arrows>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

标号用中文的

Ternary
: The only operator with three parameters: `cond ? resultA : resultB`. If `cond` is truthy, returns `resultA`, otherwise `resultB`.
按位操作
:位运算符在位级上使用整数:当需要时,请参阅[docs](mdn:/JavaScript/Reference/Operators/Bitwise_Operators)。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参阅后 空格


The binary plus `+` concatenates strings. And if any of the operands is a string, the other one is converted to string too:
算数运算符
:常规的比如:`+ - * /`(加减乘除),以及取余操作 `%` 和幂运算符 `**` 。
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

标号用中文的

liangkai and others added 2 commits May 14, 2018 18:23
@leviding
Copy link
Copy Markdown
Member

@liang-kai 符号的使用上还有些问题,就是开头的那个冒号是本 Repo 的固定渲染格式,不用改动,我已经给改回来了。辛苦啦,可以看下记录哈 e41eee7

@leviding leviding merged commit 5bbe28e into javascript-tutorial:zh-hans May 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants