Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS:用includes方法替代或判断,替代indexOf方法 #65

Open
smileyby opened this issue May 25, 2021 · 0 comments
Open

JS:用includes方法替代或判断,替代indexOf方法 #65

smileyby opened this issue May 25, 2021 · 0 comments
Labels

Comments

@smileyby
Copy link
Owner

var flag1 = true;
var flag2 = false;
if (flag1 || flag2) {
// 执行逻辑处理
}
if ([flag1,flag2].include(true)) {
// 执行逻辑处理
}

var str = ‘这是一段包含敏感字的文字窝曹’
str.indexOf(‘窝曹’) > -1;
str.includes('窝曹');

@smileyby smileyby added the JavaScript ☀️ JavaScript label May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant