我使用ParseHub以有条件的方式获取链接。我只能使用这种格式的条件提取URL,我想知道为什么前面需要感叹号?
!toLowerCase($e.text).includes("conditional")发布于 2022-04-19 22:18:37
感叹号否定表达式。您的意思是用这一行代码“如果文本包含而不是包含字符串'conditional',那么做一些事情.”
演示这一点的一种简单方法是使用以下代码行:
console.log(!true);
我们要改变条件。所以true显然是真的,但是!true等于false,因为它已经翻转了。
!被称为bang或not运算符,您可以阅读关于它的这里。
const string = 'hello world'
// does it include 'hello'?
console.log(string.includes('hello')) // true! it does include 'hello'
// does it NOT include 'hello'?
console.log(!string.includes('hello')) // false. it does include 'hello'
发布于 2022-04-19 22:15:39
我相信感叹号在这里更像是javascript的东西。查看您的代码片段,这意味着它否定了.includes结果。如果它是真的,它将被逆转为假,反之亦然。
https://stackoverflow.com/questions/71931912
复制相似问题