3.3 KiB
3.3 KiB
id, title, challengeType, videoUrl, forumTopicId, localeTitle
id | title | challengeType | videoUrl | forumTopicId | localeTitle |
---|---|---|---|---|---|
56533eb9ac21ba0edf2244ab | Understanding Case Sensitivity in Variables | 1 | https://scrimba.com/c/cd6GDcD | 18334 | Понимание чувствительности к регистру в переменных |
Description
MYVAR
- это не то же самое, что MyVar
и myvar
. Возможно иметь несколько разных переменных с одним и тем же именем, но с другим корпусом. Настоятельно рекомендуется, чтобы для ясности вы не использовали эту функцию языка. Лучшая практика
Введите имена переменных в JavaScript в camelCase . В camelCase имена переменных с несколькими словами имеют первое слово в нижнем регистре, а первая буква каждого последующего слова заглавная. Примеры:var someVariable;
var anotherVariableName;
var thisVariableNameIsSoLong;
Instructions
Не создавайте никаких новых переменных.
Tests
tests:
- text: <code>studlyCapVar</code> is defined and has a value of <code>10</code>
testString: assert(typeof studlyCapVar !== 'undefined' && studlyCapVar === 10);
- text: <code>properCamelCase</code> is defined and has a value of <code>"A String"</code>
testString: assert(typeof properCamelCase !== 'undefined' && properCamelCase === "A String");
- text: <code>titleCaseOver</code> is defined and has a value of <code>9000</code>
testString: assert(typeof titleCaseOver !== 'undefined' && titleCaseOver === 9000);
- text: <code>studlyCapVar</code> should use camelCase in both declaration and assignment sections.
testString: assert(code.match(/studlyCapVar/g).length === 2);
- text: <code>properCamelCase</code> should use camelCase in both declaration and assignment sections.
testString: assert(code.match(/properCamelCase/g).length === 2);
- text: <code>titleCaseOver</code> should use camelCase in both declaration and assignment sections.
testString: assert(code.match(/titleCaseOver/g).length === 2);
Challenge Seed
// Declarations
var StUdLyCapVaR;
var properCamelCase;
var TitleCaseOver;
// Assignments
STUDLYCAPVAR = 10;
PRoperCAmelCAse = "A String";
tITLEcASEoVER = 9000;
Solution
var studlyCapVar;
var properCamelCase;
var titleCaseOver;
studlyCapVar = 10;
properCamelCase = "A String";
titleCaseOver = 9000;