课程: JavaScript: The Tricky Bits
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Challenge: Iterate differently
(upbeat music) - [Instructor] In this challenge, it's time to work with some data iterating and processing it without using any for loops. Here in Chrome, I can see what I'm getting at here. I'm going to have a select box with a variety of states, which I've totally made up their names. And once I choose one, I'm going to get the total population and the mean population. These values are just placeholders for now. Let's take a look at the source code to see what we have to start out with. Here's the HTML, and here is my states select box, which starts out with nothing except for a blank choose element. And then here are my placeholders where the total population and the mean population will go. And I'm using tailwinds hidden class to make sure that this is not displayed when the page first loads. Won't appear until we actually have something to display. And then over here in the JavaScript file, we can see our…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
Pain point: Sequential for loops become tedious3 分钟 52 秒
-
Solution: Three alternatives8 分钟 10 秒
-
(已锁定)
Pain point: Processing arrays with loops is inelegant3 分钟 22 秒
-
(已锁定)
Solution: filter(), map(), and reduce()11 分钟 3 秒
-
(已锁定)
Challenge: Iterate differently3 分钟 32 秒
-
(已锁定)
Solution: Iterate differently3 分钟 6 秒
-
-
-
-