879 B
879 B
id, title, challengeType, videoUrl, forumTopicId, dashedName
id | title | challengeType | videoUrl | forumTopicId | dashedName |
---|---|---|---|---|---|
56533eb9ac21ba0edf2244a9 | 使用賦值運算符初始化變量 | 1 | https://scrimba.com/c/cWJ4Bfb | 301171 | initializing-variables-with-the-assignment-operator |
--description--
通常在聲明變量的時候會給變量初始化一個初始值。
var myVar = 0;
創建一個名爲 myVar
的變量,並指定其初始值爲 0
。
--instructions--
通過關鍵字 var
定義一個變量 a
,並且給它一個初始值 9
。
--hints--
應該初始化 a
的值爲 9
。
assert(/var\s+a\s*=\s*9(\s*;?\s*)$/.test(code));
--seed--
--after-user-code--
if(typeof a !== 'undefined') {(function(a){return "a = " + a;})(a);} else { (function() {return 'a is undefined';})(); }
--seed-contents--
--solutions--
var a = 9;