Files
freeCodeCamp/curriculum/challenges/chinese-traditional/02-javascript-algorithms-and-data-structures/basic-javascript/declare-string-variables.md
Nicholas Carrigan (he/him) 3da4be21bb chore: seed chinese traditional (#42005)
Seeds the chinese traditional files manually so we can deploy to
staging.
2021-05-05 22:43:49 +05:30

1.5 KiB

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
bd7123c9c444eddfaeb5bdef 聲明字符串變量 1 https://scrimba.com/c/c2QvWU6 17557 declare-string-variables

--description--

之前我們寫過這樣的代碼:

var myName = "your name";

"your name" 被稱作字符串字面量。 這是一個字符串,因爲它是一系列包含在單引號或雙引號中的零或多個字符。

--instructions--

創建兩個新的字符串變量:myFirstNamemyLastName,並用你的姓和名分別爲它們賦值。

--hints--

myFirstName 應該是一個字符串,至少包含一個字符。

assert(
  (function () {
    if (
      typeof myFirstName !== 'undefined' &&
      typeof myFirstName === 'string' &&
      myFirstName.length > 0
    ) {
      return true;
    } else {
      return false;
    }
  })()
);

myLastName 應該是一個字符串,至少包含一個字符。

assert(
  (function () {
    if (
      typeof myLastName !== 'undefined' &&
      typeof myLastName === 'string' &&
      myLastName.length > 0
    ) {
      return true;
    } else {
      return false;
    }
  })()
);

--seed--

--after-user-code--

if(typeof myFirstName !== "undefined" && typeof myLastName !== "undefined"){(function(){return myFirstName + ', ' + myLastName;})();}

--seed-contents--


--solutions--

var myFirstName = "Alan";
var myLastName = "Turing";