Try using the below code:
-new Date().getTimezoneOffset()/60;
Here, the getTimezoneOffset() method is used to subtract your time from GMT and return the number of minutes. Therefore, if you live in GMT-8, it returns 480.
If you want to put this into hours, divide by 60.
Note: The sign used in the above code is the opposite of what you need - it's used to calculate GMT's offset from your time zone, not your time zone's offset from GMT. To fix this, you just need to multiply by -1.