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

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -