Last Updated: December 26, 2018
·
1.447K
· jisaacks

JavaScript Gotcha

If you are in the U.S. execute this JavaScript:

alert(new Date("2012-01-01").getFullYear());

Want to know why it returns 2011? Read my article

1 Response
Add your response

Nice gotcha. I appreciate that you gave a little intro on the Coderwall post and not just a link to your blog. I am seeing that a fair amount lately.

over 1 year ago ·

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Related Tags
#javascript
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside