const myScript = policy.createScript("eval('2 + 2')");
console.log(trustedTypes.isScript(myScript)); // true;
const fake = Object.create(TrustedScript.prototype);
console.log(trustedTypes.isScript(fake)); // false
console.log(trustedTypes.isScript("eval('2 + 2')")); // falseTrustedTypePolicyFactory: isScript() method / notebook
TrustedTypePolicyFactory: isScript() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.