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

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -