js test

test() 方法用于检测一个字符串是否匹配某个模式.

例如:

var isWebkit = /Webkit/i.test(navigator.userAgent),
isChrome = /Chrome/i.test(navigator.userAgent),
isMobile = !!("ontouchstart" in window),
isAndroid = /Android/i.test(navigator.userAgent),

此处评论已关闭