有没有一种方法可以将所有潜在参数保存在数组中? [英] Is there a way where I can hold all potential arguments in an array?

查看:82
本文介绍了有没有一种方法可以将所有潜在参数保存在数组中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

再见(今天滚动).

在jQuery/Javascript中,有一种有效地实现此目的的方法:

var myArray = [ 'zero', 'one', 'two', 'three', 'four', 'five' ];

//get input from user
if (inputFromUser == anythingInArray) {
  alert("it's possible!);
}

解决方案

是这个吗?

http://api.jquery.com/jQuery.inArray/

Hey again (on a roll today).

In jQuery/Javascript is there a way of effectively having this:

var myArray = [ 'zero', 'one', 'two', 'three', 'four', 'five' ];

//get input from user
if (inputFromUser == anythingInArray) {
  alert("it's possible!);
}

解决方案

is it this?

http://api.jquery.com/jQuery.inArray/

这篇关于有没有一种方法可以将所有潜在参数保存在数组中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆