Git Product home page Git Product logo

javascript's Issues

5.3 翻译有误

5.3 翻译有误
英文原文L“5.3 Use object destructuring for multiple return values, not array destructuring.”
您翻译成“多个返回值用对象的解构,而不是数据解构。”
“array destructuring” 应该翻译成“数组解构”。

16.3 和 23.10

16.3 最后一个 //good 内的 else 是不是没必要?

// good
function dogs(x) {
  if (x) {
    if (z) {
      return y;
    }
  } else {
    return z;
  }
}

23.10 以下语法不是挺规范的吗?为什么是不友好的呢?难道变量名含义问题?

// bad
export const THING_TO_BE_CHANGED = 'should obviously not be uppercased';

3.7 中 has包使用存在问题

3.7对象验证属性中使用了has包,
根据测试,has.call(object,key)不能正确使用,
应当按照npm包库中作者的要求直接使用has(object,key)进行验证。

21.1小节中 good样例的引号使用不正确

// good
const reaction = "No! That’s impossible!";
(async function meanwhileOnTheFalcon() {
  // handle `leia`, `lando`, `chewie`, `r2`, `c3p0`
  // ...
}());

此处应为单引号

// good
const reaction = 'No! That’s impossible!';
(async function meanwhileOnTheFalcon() {
  // handle `leia`, `lando`, `chewie`, `r2`, `c3p0`
  // ...
}());

函数命名及书写不规范范例

函数 7.1

1. 使用 function foo() {} 形式,导致作用域提升,会出现在函数被声明之前就可以使用

// 函数调用出现在函数定义之前,当代码行数比较多时,定位函数比较不方便,不利于从上到下阅读代码的习惯
doSomething();

function doSomething() {
    // ...
}


// 推荐如下形式
const doSomething = function() {
    // ...
};
doSomething(); 

1. 推荐使用命名函数,而不是匿名函数,在函数体报错时方便追踪

// doSomething.js
// 报错信息只会定位到这个文件, 不会提示名称
export default () => {
  console.log('匿名函数');
  throw new Error('匿名函数');
}

// main.js
import doSomething from './doSomething';

doSomething();
image
// 命名函数报错
export default function namedFunction() {
  console.log('命名函数');
  throw new Error('命名函数');
}
image

5.1 翻译存疑

Destructuring 一章的 5.1 中
英文原本是**“Why? Destructuring saves you from creating temporary references for those properties.”**,
您翻译为“Why? 解构保存了这些属性的临时值/引用”,
个人认为应当翻译为“Why?因为解构使您不必为这些属性创建临时引用。”
个人愚见。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.