# 问题 当清空输入框时 `search` 的 `value` 为空,此时所有诗句全部符合匹配规则,导致它们全部显示在页面中。 # 解决 在 `displayMatches` 函数开头添加一个判断,如果输入框为空不做处理: ```js if (!this.value) { return } ``` > 位置 https://github.com/soyaine/JavaScript30/blob/1b044bc6610cbb131d897d9a3cc814372a414018/06%20-%20Type%20Ahead/index-SOYAINE.html#L38