课程: JavaScript: The Tricky Bits

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Challenge: Objects of hazard

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…

内容