Day of the week: Difference between revisions

added coffeescript solutions
(Added K example)
(added coffeescript solutions)
Line 416:
<pre>(2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118)</pre>
 
=={{header|CoffeeScript}}==
 
<lang coffeescript>for year in [2008...2121]
xmas = new Date year, 11, 25
console.log "#{xmas.toDateString()} is a Sunday" if xmas.getDay() is 0</lang>
 
or in a shorter/convoluted version:
 
<lang coffeescript>for year in [2008...2121]
if (xmas = new Date year, 11, 25).getDay() is 0 then console.log xmas.getFullYear()
</lang>
 
or yet:
 
<lang coffeescript>console.log year for year in [2008...2121] when new Date(year, 11, 25).getDay() is 0</lang>
 
=={{header|ColdFusion}}==
Anonymous user