JS built-in Object Practice (MU class network topics)

Source: Internet
Author: User
Tags ming ord

:

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.