Created
July 18, 2019 05:52
-
-
Save mmis1000/a9db1df6de2902edd9b17047459b2022 to your computer and use it in GitHub Desktop.
Detect v8 js engine using undefined behavior of v8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isChrome = (() => { | |
with ({}) { | |
var a = new ArrayBuffer(16) | |
new Float64Array(a)[0] = NaN | |
new Uint8Array(a)[0] = 1 | |
new Float64Array(a)[1] = new Float64Array(a)[0] | |
return new Uint8Array(a)[8] === 1 | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment