课程: JavaScript: Best Practices for Data
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Challenge: Compare values
(upbeat bouncy music) - [Narrator] Ready to try your hand at writing better comparisons? It's time for a challenge. I've written some code that simulates a shopping cart and performs a few actions based on values in the cart object. Your task is to update the code to make it easier to read and to follow best practices for comparisons. Add rules as appropriate to .ESLint RC, to check for issues, as well as fixing those issues in the app.js file. Note that the code I've written is intentionally convoluted here and there. So if you're not sure what a statement is doing, take a moment, step back, and break it down. This exercise should take you about 15 minutes. When you're done, join me in the next video, and I'll walk you through how I approached it.
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
-
-
(已锁定)
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 秒
-
(已锁定)
-