楼主: Lisrelchen
2400 21

【Nicolas Bevacqua】Practical Modern JavaScript: [推广有奖]

  • 0关注
  • 62粉丝

VIP

已卖:4194份资源

院士

67%

还不是VIP/贵宾

-

TA的文库  其他...

Bayesian NewOccidental

Spatial Data Analysis

东西方数据挖掘

威望
0
论坛币
50288 个
通用积分
83.6906
学术水平
253 点
热心指数
300 点
信用等级
208 点
经验
41518 点
帖子
3256
精华
14
在线时间
766 小时
注册时间
2006-5-4
最后登录
2022-11-6

楼主
Lisrelchen 发表于 2017-7-14 08:40:17 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
  1. Modular JS: Practical ES6: Dive into ES6 and the Future of JavaScript11 Jul 2017
  2. by Nicolas Bevacqua
  3. pages 页数:( 334)
  4. Release 出版日期: O′Reilly (11 July 2017)
  5. Language 语言: English
  6. ISBN-10 书号 149194353X
  7. ISBN-13 书号: 9781491943533
  8. Book Description
  9. To get the most out of modern JavaScript, you need learn the latest features of its parent specification, ECMAScript 6 (ES6). This book provides a highly practical look at ES6, without getting lost in the specification or its implementation details. Armed with practical examples, author Nicolas Bevacqua shows you new ways to deal with asynchronous flow control, declare objects or functions, and create proxies or unique sets, among many other features.

  10. The first title in Bevacqua’s Modular JavaScript series, Practical Modern JavaScript prepares JavaScript and Node.js developers for applied lessons in modular design, testing, and deployment in subsequent books.

  11. This book explains:

  12. How JavaScript and its standards development process have evolved
  13. Essential ES6 changes, including arrow functions, destructuring, let and const
  14. Class syntax for declaring object prototypes, and the new Symbol primitive
  15. How to handle flow control with Promises, iterators, generators, and async functions
  16. ES6 collection built-in types for creating object maps and unique sets
  17. How and when to use the new Proxy and Reflect built-ins
  18. Changes to Array, Math, numbers, strings, Unicode, and regular expressions, and other improvements since ES5
  19. Contents
  20. Chapter 1. ECMAScript and the Future of JavaScript
  21. Chapter 2. ES6 Essentials
  22. Chapter 3. Classes, Symbols, Objects, and Decorators
  23. Chapter 4. Iteration and Flow Control
  24. Chapter 5. Leveraging ECMAScript Collections
  25. Chapter 6. Managing Property Access with Proxies
  26. Chapter 7. Built-in Improvements in ES6
  27. Chapter 8. JavaScript Modules
  28. Chapter 9. Practical Considerations
复制代码

本帖隐藏的内容

Practical Modern JavaScript.pdf (3.38 MB, 需要: 5 个论坛币)


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝


本帖被以下文库推荐

沙发
Lisrelchen(未真实交易用户) 发表于 2017-7-14 08:43:16
  1. 2.1.2 Computed Property Names
  2. Sometimes you have to declare objects that contain properties with names
  3. based on variables or other JavaScript expressions, as shown in the following
  4. piece of code written in ES5. For this example, assume that expertise is
  5. provided to you as a function parameter, and is not a value you know
  6. beforehand:
  7. var expertise = 'journalism'
  8. var person = {
  9. name: 'Sharon',
  10. age: 27
  11. } person[expertise] =
  12. {
  13. years: 5,
  14. interests: ['international', 'politics', 'internet']
  15. }
复制代码

藤椅
Lisrelchen(未真实交易用户) 发表于 2017-7-14 08:45:09
  1. 2.1.3 Method Definitions
  2. Typically, you can declare methods on an object by adding properties to it. In
  3. the next snippet, we’re creating a small event emitter that supports multiple
  4. kinds of events. It comes with an emitter#on method that can be used to
  5. register event listeners, and an emitter#emit method that can be used to
  6. raise events:
  7. var emitter = {
  8. events: {},
  9. on: function (type, fn) {
  10. if (this.events[type] === undefined) {
  11. this.events[type] = []
  12. }
  13. this.events[type].push(fn)
  14. },
  15. emit: function (type, event) {
  16. if (this.events[type] === undefined) {
  17. return
  18. }
  19. this.events[type].forEach(function (fn) {
  20. fn(event)
  21. })
  22. }
  23. }
复制代码

板凳
Lisrelchen(未真实交易用户) 发表于 2017-7-14 08:46:47
  1. 2.2.1 Lexical Scoping
  2. In the body of an arrow function, this, arguments, and super point to the
  3. containing scope, since arrow functions don’t create a new scope. Consider
  4. the following example. We have a timer object with a seconds counter and a
  5. start method defined using the syntax we learned about earlier. We then
  6. start the timer, wait for a few seconds, and log the current amount of elapsed
  7. seconds:
  8. var timer = {
  9. seconds: 0,
  10. start() {
  11. setInterval(() => {
  12. this.seconds++
  13. }, 1000)
  14. }
  15. } timer.start()
  16. setTimeout(function () {
  17. console.log(timer.seconds)
  18. }, 3500)
  19. // <- 3
复制代码

报纸
Lisrelchen(未真实交易用户) 发表于 2017-7-14 08:50:36
  1. 2.3.2 Destructuring Arrays
  2. The syntax for destructuring arrays is similar to that of objects. The following
  3. example shows a coordinates object that’s destructured into two variables: x
  4. and y. Note how the notation uses square brackets instead of curly braces;
  5. this denotes we’re using array destructuring instead of object destructuring.
  6. Instead of having to sprinkle your code with implementation details like x =
  7. coordinates[0], with destructuring you can convey your meaning clearly
  8. and without explicitly referencing the indices, naming the values instead.
  9. var coordinates = [12, -7]
  10. var [x, y] = coordinates
  11. console.log(x)
  12. // <- 12
复制代码

地板
Lisrelchen(未真实交易用户) 发表于 2017-7-14 08:51:55
  1. 2.3.3 Function Parameter Defaults
  2. Function parameters in ES6 enjoy the ability of specifying default values as
  3. well. The following example defines a default exponent with the most
  4. commonly used value.
  5. function powerOf(base, exponent = 2) {
  6. return Math.pow(base, exponent)
  7. }
  8. Defaults can be applied to arrow function parameters as well. When we have
  9. default values in an arrow function we must wrap the parameter list in
  10. parentheses, even when there’s a single parameter
复制代码

7
Lisrelchen(未真实交易用户) 发表于 2017-7-14 08:54:16
  1. 2.3.4 Function Parameter Destructuring
  2. A better approach than merely providing a default value might be to
  3. destructure options entirely, providing default values for each property,
  4. individually, within the destructuring pattern. This approach also lets you
  5. reference each option without going through an options object, but you lose
  6. the ability to reference options directly, which might represent an issue in
  7. some situations.
  8. function carFactory({ brand = 'Volkswagen', make = 1999 }) {
  9. console.log(brand)
  10. console.log(make)
  11. } carFactory({ make: 2000 })
  12. // <- 'Volkswagen'
  13. // <- 200
复制代码

8
Lisrelchen(未真实交易用户) 发表于 2017-7-14 08:55:59
  1. 2.3.5 Use Cases for Destructuring
  2. Whenever there’s a function that returns an object or an array, destructuring
  3. makes it much terser to interact with. The following example shows a
  4. function that returns an object with some coordinates, where we grab only the
  5. ones we’re interested in: x and y. We’re avoiding an intermediate point
  6. variable declaration that often gets in the way without adding a lot of value to
  7. the readability of your code.
  8. function getCoordinates() {
  9. return { x: 10, y: 22, z: -1, type: '3d' }
  10. } var {
  11. x, y
  12. }
  13. =
  14. getCoordinates()
  15. The case for default option values bears repeating. Imagine you have a
  16. random function that produces random integers between a min and a max
  17. value, and that it should default to values between 1 and 10. This is
  18. particularly interesting as an alternative to named parameters in languages
  19. with strong typing features, such as Python and C#. This pattern, where
  20. you’re able to define default values for options and then let consumers
  21. override them individually, offers great flexibility.
  22. function random({ min = 1, max = 10 } = {}) {
  23. return Math.floor(Math.random() * (max - min)) + min
  24. } console.log(random())
  25. // <- 7
  26. console.log(random({ max: 24 }))
  27. // <- 18
复制代码

9
西门高(未真实交易用户) 发表于 2017-7-14 09:08:46
谢谢分享

10
MouJack007(未真实交易用户) 发表于 2017-7-14 09:24:27
谢谢楼主分享!

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-22 08:22