--- id: 5a24bbe0dba28a8d3cbd4c5e title: Add Comments in JSX challengeType: 6 isRequired: false videoUrl: '' localeTitle: 在JSX中添加注释 --- ## Description
JSX是一种可以编译成有效JavaScript的语法。有时,为了便于阅读,您可能需要在代码中添加注释。像大多数编程语言一样,JSX有自己的方法来做到这一点。要将注释放在JSX中,可以使用语法{/* */}来包含注释文本。
## Instructions
代码编辑器的JSX元素与您在上一个挑战中创建的元素类似。在提供的div元素中的某处添加注释,而不修改现有的h1p元素。
## Tests
```yml tests: - text: 常量JSX应该返回一个div元素。 testString: 'assert(JSX.type === "div", "The constant JSX should return a div element.");' - text: div应包含一个h1标记作为第一个元素。 testString: 'assert(JSX.props.children[0].type === "h1", "The div should contain an h1 tag as the first element.");' - text: div应该包含一个p标签作为第二个元素。 testString: 'assert(JSX.props.children[1].type === "p", "The div should contain a p tag as the second element.");' - text: JSX应该包含一条评论。 testString: 'getUserInput => assert(getUserInput("index").includes("/*") && getUserInput("index").includes("*/"), "The JSX should include a comment.");' ```
## Challenge Seed
```jsx const JSX = (

This is a block of JSX

Here's a subtitle

); ```
### After Test
```js console.info('after the test'); ```
## Solution
```js // solution required ```