We all see the feature detects doing something like:
var touch = function () {
return 'ontouchstart' in window;
};
But I'm wondering if there are any other benefits to using the in
operator over something like this (which saves a few bytes)?
var touch = function () {
return !!window.ontouchstart;
};
Are there any other benefits to using in
?