课程: JavaScript: Best Practices for Data
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Use individual statements to create variables - JavaScript教程
课程: JavaScript: Best Practices for Data
Use individual statements to create variables
- [Instructor] JavaScript allows the declaration of multiple variables using a single keyword, like in my code here. It can make code more concise, but it has some drawbacks. One issue is that it's a little too easy to put in a semicolon instead of a comma, or vice versa, and that kind of error is subtle and can be difficult to identify. Also, when you're using a debugging tool, you can step through separate statements individually, rather than all at once when they're declared like this. So I prefer to use separate statements when I create variables. ESLint has a rule for this, which is one bar. This rule supports a lot of configuration options for different keywords. But I want to do a more broad-based rule. I need to specify an issue level and a rule as an array. So that's one dash var colon, and then my array with an issue level of error, and a rule of never. So I'll save that, and over in my app.js file, I have…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
Prefer const, then let5 分钟 7 秒
-
(已锁定)
Use individual statements to create variables1 分钟 41 秒
-
(已锁定)
Create descriptive variable names3 分钟
-
(已锁定)
Standardize acronym case2 分钟 22 秒
-
(已锁定)
Remove unused variables1 分钟 18 秒
-
(已锁定)
Challenge: Declare variables45 秒
-
(已锁定)
Solution: Declare variables5 分钟 38 秒
-
-
-
-
-