javascript for array rotation -


trying understand how code below brings number between 0-6

var dayinmili = 86400000; var weekinmili = 604800000; //datetime() returns miliseconds since thurs, jan 1 1970, need account week starting monday not thursday. while (currenttime.getday() != 1){   currenttime.settime(currenttime.gettime() - dayinmili); } //we need find number of weeks since beginning of year can //  use determine schedule rotation var weeks = math.floor(currenttime.gettime() / weekinmili ); var startpoint = weeks % 7; 

the modulo operator in last line returns remainder after dividing seven. in case, result assigned startpoint going 0 - 6.


Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -