2.9 KiB
2.9 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
56533eb9ac21ba0edf2244ab | Understanding Case Sensitivity in Variables | 1 | 了解变量中的大小写敏感度 |
Description
MYVAR
与MyVar
和myvar
。可以有多个具有相同名称但不同外壳的不同变量。强烈建议您为清晰起见, 不要使用此语言功能。 最佳实践
在camelCase中用 JavaScript编写变量名。在camelCase中 ,多字变量名称的第一个单词为小写,每个后续单词的首字母大写。 例子:var someVariable;
var anotherVariableName;
var thisVariableNameIsSoLong;
Instructions
不要创建任何新变量。
Tests
tests:
- text: <code>studlyCapVar</code>已定义且值为<code>10</code>
testString: 'assert(typeof studlyCapVar !== "undefined" && studlyCapVar === 10, "<code>studlyCapVar</code> is defined and has a value of <code>10</code>");'
- text: <code>properCamelCase</code>已定义且值为<code>"A String"</code>
testString: 'assert(typeof properCamelCase !== "undefined" && properCamelCase === "A String", "<code>properCamelCase</code> is defined and has a value of <code>"A String"</code>");'
- text: <code>titleCaseOver</code>已定义,其值为<code>9000</code>
testString: 'assert(typeof titleCaseOver !== "undefined" && titleCaseOver === 9000, "<code>titleCaseOver</code> is defined and has a value of <code>9000</code>");'
- text: <code>studlyCapVar</code>应该在声明和赋值部分使用camelCase。
testString: 'assert(code.match(/studlyCapVar/g).length === 2, "<code>studlyCapVar</code> should use camelCase in both declaration and assignment sections.");'
- text: <code>properCamelCase</code>应该在声明和赋值部分使用camelCase。
testString: 'assert(code.match(/properCamelCase/g).length === 2, "<code>properCamelCase</code> should use camelCase in both declaration and assignment sections.");'
- text: <code>titleCaseOver</code>应该在声明和赋值部分使用camelCase。
testString: 'assert(code.match(/titleCaseOver/g).length === 2, "<code>titleCaseOver</code> should use camelCase in both declaration and assignment sections.");'
Challenge Seed
// Declarations
var StUdLyCapVaR;
var properCamelCase;
var TitleCaseOver;
// Assignments
STUDLYCAPVAR = 10;
PRoperCAmelCAse = "A String";
tITLEcASEoVER = 9000;
Solution
// solution required