1.8 KiB
1.8 KiB
id | title | localeTitle | challengeType |
---|---|---|---|
587d7fb4367417b2b2512bfd | Add Keywords to Your package.json | 将关键字添加到package.json | 2 |
Description
0
示例
"keywords": [ "descriptive", "related", "words" ],
0
如您所见,此字段的结构为双引号字符串数组。 0
说明0
将一组合适的字符串添加到Glitch项目的package.json中的keywords-field。 0
其中一个关键字应该是freecodecamp。
Instructions
Tests
tests:
- text: package.json应该有一个有效的“关键字”键
testString: 'getUserInput => $.get(getUserInput(''url'') + ''/_api/package.json'').then(data => { var packJson = JSON.parse(data); assert(packJson.keywords, ''"keywords" is missing''); }, xhr => { throw new Error(xhr.responseText); })'
- text: '“keywords”字段应为Array'
testString: 'getUserInput => $.get(getUserInput(''url'') + ''/_api/package.json'').then(data => { var packJson = JSON.parse(data); assert.isArray(packJson.keywords, ''"keywords" is not an array''); }, xhr => { throw new Error(xhr.responseText); })'
- text: '“关键字”应包含“freecodecamp”'
testString: 'getUserInput => $.get(getUserInput(''url'') + ''/_api/package.json'').then(data => { var packJson = JSON.parse(data); assert.include(packJson.keywords, ''freecodecamp'', ''"keywords" does not include "freecodecamp"''); }, xhr => { throw new Error(xhr.responseText); })'
Challenge Seed
Solution
// solution required