tag:blogger.com,1999:blog-125341290284114978.post3605303438585964861..comments2023-04-23T00:05:10.829-07:00Comments on Guy Ellis' Tech Blog: How many Friday 13ths in a Year in JavaScriptGuy Ellishttp://www.blogger.com/profile/02574435376236977220noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-125341290284114978.post-33836342002135694352013-12-11T19:12:12.918-08:002013-12-11T19:12:12.918-08:00The second one seems like it's trying hard to ...The second one seems like it's trying hard to be clever. I'm not a fan of relying on side effects that could change some day nor do I like having to step through several times to understand what is happening. I changed the significant line to the following, which I think is much clearer:<br /><br />count += (new Date(year, month, 13).getDay() === 5) ? 1 : 0;bbrownhttps://www.blogger.com/profile/12777868386569441565noreply@blogger.com