freeCodeCamp/curriculum/challenges/chinese/02-javascript-algorithms-an.../basic-javascript/declare-string-variables.ch...

1.8 KiB

id title challengeType videoUrl localeTitle
bd7123c9c444eddfaeb5bdef Declare String Variables 1 声明字符串变量

Description

以前我们使用过代码var myName = "your name"; "your name"被称为字符串 文字 。它是一个字符串,因为它是用单引号或双引号括起来的一系列零个或多个字符。

Instructions

创建两个新的string变量: myFirstNamemyLastName并分别为它们分配myFirstNamemyLastName的值。

Tests

tests:
  - text: <code>myFirstName</code>应该是一个至少包含一个字符的字符串。
    testString: 'assert((function(){if(typeof myFirstName !== "undefined" && typeof myFirstName === "string" && myFirstName.length > 0){return true;}else{return false;}})(), "<code>myFirstName</code> should be a string with at least one character in it.");'
  - text: <code>myLastName</code>应该是一个至少包含一个字符的字符串。
    testString: 'assert((function(){if(typeof myLastName !== "undefined" && typeof myLastName === "string" && myLastName.length > 0){return true;}else{return false;}})(), "<code>myLastName</code> should be a string with at least one character in it.");'

Challenge Seed

// Example
var firstName = "Alan";
var lastName = "Turing";

// Only change code below this line

After Test

console.info('after the test');

Solution

// solution required