Files
freeCodeCamp/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-javascript/initializing-variables-with-the-assignment-operator.md
Nicholas Carrigan (he/him) aff0ea700d chore(i8n,learn): processed translations (#41350)
* chore(i8n,learn): processed translations

* fix: restore deleted test

* fix: revert casing change

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
2021-03-04 10:49:46 -07:00

866 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;