How to check if I run JavaScript code in a browser or not in a browser? -
How to check if I run this code in a browser or not in the browser? I have something like this
var x = 5; If (/ * inside a browser * /) document.write (x); Else / * without browser * / console.log (x); = 'Undefined') (/ => unchangeable)
/ I I am inside the environment; And {// am elsewhere (server?)}
Comments
Post a Comment