:
XXXX year XX month x Day week x--class Total is divided into: 81
Format requirements:
1. Display the date of printing. The format is similar to the current time of "xxxx year XX month XX day week X".
2. Calculate the average (reserved integer) of the class.
Student performance data are as follows:
"Xiao Ming: 87; Floret: 81; Little Red: 97; Small day: 76; Xiao Zhang: 74; little: 94; Xiao XI: 90; Xiao Wu: 76; Dicky: 64; Small ord: 76 "
My answers
<! DOCTYPE html>//get the current date by using the JavaScript Date object and output. varDay = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; varDate =NewDate (); varindex =Date.getday (); varMyyear =date.getfullyear (); varMymon = Date.getmonth () +1; varMyDate =date.getdate (); //The result is a long-channeling string bad processing, find the rule after the split into the array better operation Oh varScorestr = "Xiao Ming: 87; Floret: 81; Little red: 97; Small day: 76; Xiao Zhang: 74; little: 94; Xiao XI: 90; Xiao Wu: 76; Dicky: 64; Small ord: 76"; vararr = Scorestr.split (":"); Arr.shift (); //Extract the scores from the array, then sum them up and output them. varARR1 = []; for(vari = 0; i < arr.length; i++) {Arr1[i]=parseint (Arr[i]); } varSum =0; functionAdd (arr) { for(vari=0;i<arr.length;i++) {sum+=Arr[i]; } returnsum; } varEnd = Math.Round (Add (arr1)/arr1.length); document.write (myyear+ "year" +mymon+ "month" +mydate+ "Day" +day[index]+ "--class score is" +end);</script></body>Output results
September 9, 2017 Saturday--class total divided into 82
JS built-in Object Practice (MU class network topics)