I need some function returning a boolean value to check if the browser is Chrome.
How do I create such functionality?
If you want to detect Chrome's rendering engine (so not specific features in Google Chrome or Chromium), a simple option is:
var isChrome = !!window.chrome;
NOTE: this also returns true
for many versions of Edge, Opera, etc that are based on Chrome (thanks @Carrm for pointing this out). Avoiding that is an ongoing battle (see window.opr
below) so you should ask yourself if you're trying to detect the rendering engine (used by almost all major modern browsers in 2020) or some other Chrome (or Chromium?) -specific feature.
And you can probably skip !!