I am new to /ipad/i.test(navigator.userAgent.toLowerCase())
syntax. I know the results it returns true for ipad and false for remaining browsers.
please any
/ipad/i
is Regex. ipad
is taken literally, but the i
will make the whole string case-insensitive. .test
will test the given string to see if it satisfies the regex. navigator.userAgent
is a string that browsers give identifying themselves (like "Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25"). "toLowerCase" does exactly that.
Using both /i
(case-insensitive), and toLowerCase is redundant. I suggest just using navigator.userAgent.indexOf('iPad') !== -1
, since iPad always has the same capitalization.