课程: JavaScript: Best Practices for Data
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Solution: Compare values
(upbeat music) - [Instructor] So, at the top of my code, I have a cart object, and then I have all of this logical code with all of these comparisons starting on line 11. And looking at this line by line, basically this section is checking the number of items in the cart using some other factors to calculate the shipping, or whether shipping needs to be determined later, and then down here there's this contact property we're setting a value for, and that I just thought of as if there's some complications going on with this order, then we'll flag it to have someone actually reach out, contact the customer, and resolve some issues, or iron some logistics out. So, I'm going to start with the flow control up here. Save that nice, gnarly ternary for a little bit later, and this is one of those places where I think putting the ESLint rules in place first can be really helpful, 'cause they can point out some of those errors…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
-
-
(已锁定)
Use triple-character equality operators2 分钟 56 秒
-
(已锁定)
Don't use Yoda conditions1 分钟 52 秒
-
(已锁定)
Compare appropriately for the data type2 分钟 2 秒
-
(已锁定)
Use ternary statements judiciously3 分钟 23 秒
-
(已锁定)
Add parentheses to clarify logic2 分钟 3 秒
-
(已锁定)
Challenge: Compare values53 秒
-
(已锁定)
Solution: Compare values9 分钟 29 秒
-
(已锁定)
-