Last active
December 20, 2015 19:19
-
-
Save homleen/6182232 to your computer and use it in GitHub Desktop.
生成2013年所有的日期,并随即生成一个对应的值
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var start = new Date(2013, 0, 1); | |
var end = new Date(2014, 0, 1); | |
var data = []; | |
while (start < end) { | |
data.push( [start.getTime() / 1000, Math.floor( Math.random() * 6) ] ); | |
start = new Date(start.setDate( | |
start.getDate() + 1 | |
)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var start = new Date(2013, 0, 1); | |
var end = new Date(2014, 0, 1); | |
var dates = {}; | |
while (start < end) { | |
var prop = start.getTime() / 1000; | |
dates[prop] = Math.floor( Math.random() * 6 ); | |
start = new Date(start.setDate( | |
start.getDate() + 1 | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment