javascript - 我不理解 javascript 中的 if else 语句。谁能解释一下?
问题描述
我正在阅读这段代码:
enter code here
table.onclick = function(event) {
let td = event.target.closest('td');
**if (!td) return;
if (!table.contains(td)) return;**
detail(td);
};
但我不明白为什么 if 语句中没有花括号。为什么没有其他部分。我也不知道一行 if 语句中的 return 是什么意思。这段代码是什么意思。
解决方案
推荐阅读
- php - 如何将与 php 中的 html 表单中的字符串相同的图像发送到服务器或作为对 API 的请求
- android - 在颤振中使用流生成器时,我不断收到轻微的空错误
- javascript - 如何将不可点击的纯文本 URL 转换为 HTML 源中的链接
- javascript - 编写高尔夫代码比基本代码更干净
- flutter - 嵌套流构建器以从云 Firestore 获取数据
- python - 使用 MYSQL 查询查询数据库时,SQL Alchemy 非常缓慢
- python - 如何重定向到页面并将数据传递到重定向的 url?
- sql - 如何从 SQL 检索多个数据到 VBA 文本框?
- r - 使用 NA 值循环滚动窗口回归
- javascript - 我如何在php中更改URL路径