Example 1 — Feature Detection
Check whether this browser exposes a usable oscpu string.
const supported =
"oscpu" in navigator && Boolean(navigator.oscpu);
console.log(supported ? "oscpu available" : "oscpu missing"); How It Works
- Use
in. Confirms the property exists onnavigator. - Check truthiness. Empty / undefined values fail the second part.
- Expect gaps. Chromium/Safari often report missing.
- Guard before reading. Avoid assuming a string in every browser.

