课程: JavaScript: The Tricky Bits
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Challenge: Objects of hazard
(upbeat music) - [Instructor] For this challenge, we're going to apply what we've learned about objects to convert a small app from spaghetti code into a better organized object. We'll be fostering the growth of an army of friendly robots. Let's start by seeing the behavior of this app in its current state. As we've seen before, just one button to get things going, I'll click it to make myself some more robots. Here's the robot number one and robot number, wait a minute, robot number 12 and robot number two, wait a second, these robots have the same name and the same serial number. I wonder what happens if I click more. Okay, something's not right here. All these robots though they are in different positions, are sharing the same name and serial number. It doesn't matter how many of them I make. It's just evolving into chaos here, look at this. This name is getting longer and longer and longer. So let's take a look at the…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
(已锁定)
Pain point: Copied objects are not actually copies2 分钟 32 秒
-
(已锁定)
Solution: JSON.stringify() and JSON.parse()7 分钟 55 秒
-
(已锁定)
Pain point: The value of this, like, and always3 分钟 52 秒
-
(已锁定)
Solution: bind()5 分钟 38 秒
-
(已锁定)
ES6+ solution: Arrow functions3 分钟 38 秒
-
(已锁定)
Challenge: Objects of hazard4 分钟 33 秒
-
(已锁定)
Solution: Objects of hazard5 分钟 42 秒
-
(已锁定)
-
-