* feat(tools): add seed/solution restore script * chore(curriculum): remove empty sections' markers * chore(curriculum): add seed + solution to Chinese * chore: remove old formatter * fix: update getChallenges parse translated challenges separately, without reference to the source * chore(curriculum): add dashedName to English * chore(curriculum): add dashedName to Chinese * refactor: remove unused challenge property 'name' * fix: relax dashedName requirement * fix: stray tag Remove stray `pre` tag from challenge file. Signed-off-by: nhcarrigan <nhcarrigan@gmail.com> Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
2.1 KiB
2.1 KiB
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
56533eb9ac21ba0edf2244ab | 了解变量名区分大小写 | 1 | https://scrimba.com/c/cd6GDcD | 18334 | understanding-case-sensitivity-in-variables |
--description--
在 JavaScript 中所有的变量和函数名都是大小写敏感的。要区别对待大写字母和小写字母。
MYVAR
与MyVar
和myvar
是截然不同的变量。这有可能导致出现多个相似名字的的变量。所以强烈地建议你,为了保持代码清晰不要使用这一特性。
最佳实践
使用驼峰命名法来书写一个 Javascript 变量,在驼峰命名法中,变量名的第一个单词的首写字母小写,后面的单词的第一个字母大写。
示例:
var someVariable;
var anotherVariableName;
var thisVariableNameIsSoLong;
--instructions--
修改已声明的变量,让它们的命名符合驼峰命名法的规范。
--hints--
studlyCapVar
应该被定义并且值为10
。
assert(typeof studlyCapVar !== 'undefined' && studlyCapVar === 10);
properCamelCase
应该被定义并且值为"A String"
。
assert(
typeof properCamelCase !== 'undefined' && properCamelCase === 'A String'
);
titleCaseOver
应该被定义并且值为9000
。
assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000);
studlyCapVar
在声明和赋值时都应该使用驼峰命名法。
assert(code.match(/studlyCapVar/g).length === 2);
properCamelCase
在声明和赋值时都应该使用驼峰命名法。
assert(code.match(/properCamelCase/g).length === 2);
titleCaseOver
在声明和赋值时都应该使用驼峰命名法。
assert(code.match(/titleCaseOver/g).length === 2);
--seed--
--seed-contents--
// Variable declarations
var StUdLyCapVaR;
var properCamelCase;
var TitleCaseOver;
// Variable assignments
STUDLYCAPVAR = 10;
PRoperCAmelCAse = "A String";
tITLEcASEoVER = 9000;
--solutions--
var studlyCapVar;
var properCamelCase;
var titleCaseOver;
studlyCapVar = 10;
properCamelCase = "A String";
titleCaseOver = 9000;