1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
fenix001 [56]
3 years ago
11

Use the Date object and the Array object to determine and diplay information about the current date on your webpage. Your output

should look like the following (adjusted for the current date):
Computers and Technology
1 answer:
Mnenie [13.5K]3 years ago
6 0

Answer:

  1. var today = new Date();
  2. var dateComp = [];
  3. dateComp[0] = today.getDate();
  4. dateComp[1] = today.getMonth();
  5. dateComp[2] = today.getFullYear();
  6. switch(dateComp[1]){
  7.    case 0:
  8.        console.log("Jan " + dateComp[0] + "," + dateComp[2])
  9.        break;
  10.    case 1:
  11.        console.log("Feb " + dateComp[0] + "," + dateComp[2])
  12.        break;
  13.    case 2:
  14.        console.log("Mar " + dateComp[0] + "," + dateComp[2])
  15.        break;
  16.    case 3:
  17.        console.log("Apr " + dateComp[0] + "," + dateComp[2])
  18.        break;
  19.    case 4:
  20.        console.log("May " + dateComp[0] + "," + dateComp[2])
  21.        break;
  22.    case 5:
  23.        console.log("Jun " + dateComp[0] + "," + dateComp[2])
  24.        break;
  25.    case 6:
  26.        console.log("Jul " + dateComp[0] + "," + dateComp[2])
  27.        break;
  28.    case 7:
  29.        console.log("Aug " + dateComp[0] + "," + dateComp[2])
  30.        break;
  31.    case 8:
  32.        console.log("Sept " + dateComp[0] + "," + dateComp[2])
  33.        break;
  34.    case 9:
  35.        console.log("Oct " + dateComp[0] + "," + dateComp[2])
  36.        break;
  37.    case 10:
  38.        console.log("Nov " + dateComp[0] + "," + dateComp[2])
  39.        break;
  40.    case 11:
  41.        console.log("Dec " + dateComp[0] + "," + dateComp[2])
  42.        break;
  43. }

Explanation:

The solution code is written in JavaScript.

Firstly, create a Date object (Line 1). The date object will automatically capture the current date and time.

Next create an array dateComp to hold the day, month and year (Line 3 -5). We use the getDate method to get current day, getMonth method for current month and getFullYear method for current year.

This is important to note that the getMonth method will return the value range from 0 - 11 with the Jan is represented as 0, Feb is 1 and so forth. Presume we intend to display the date using the format "month day, year", we can create a switch structure to check the month value which is range from 0 to 11. If month value is 0, generate string Jan + current day + "," + current year. We generate the date string based on different switch cases (7 - 44). We shall see the output similar to the date string as shown below:

Apr 12,2020

You might be interested in
Effective character encoding requires:
Dvinal [7]

To answer your question the answer would be B compatible browsers

8 0
3 years ago
Demonstrate the register addressing mode for the following instructions. Also what addressing mode belongs to these instructions
kotykmax [81]

Answer:

Demonstrate the register addressing mode for the following instructions. Also what addressing mode belongs to these instructions?

1. MOV CX, [BX+DI]

2. MOV AX, ARRAY[CX]

3. MOV BX, [CX+DI+6]

4 0
3 years ago
An if statement must always begin with the word “if.” True False python
MrMuchimi

Answer:

true

Explanation:

6 0
3 years ago
Read 2 more answers
What is the full from of CPU?​
scZoUnD [109]

Answer:

CPU is known as <u>Central</u><u> </u><u>Processing</u><u> </u><u>Unit</u><u>.</u>

8 0
3 years ago
Read 2 more answers
460N of force is exerted on an object with a surface area of 2,5m.How much pressure is felt by the object?​
BartSMP [9]

Explanation:

p=F/A

p=460N/2m×5m

=46N/m2

7 0
2 years ago
Read 2 more answers
Other questions:
  • What does ADF means????
    13·2 answers
  • Description A data retrieval tool that finds specified data within a database A collection of records All of the fields for a si
    7·1 answer
  • Which type of financial institution typically has membership requirements?
    9·2 answers
  • Why is it important to evaluate the website on which you plan to shop?
    13·1 answer
  • Given the scenario, before leaving the office, you ask the CIO to provide which formal document authorizing you to perform certa
    11·1 answer
  • 2. What is the name for an action performed by the VR Robot?
    7·2 answers
  • ¿Que es la energía? (una sola respuesta es la correcta)
    11·1 answer
  • A customer is looking for a storage archival solution for 1,000 TB of data. The customer requires that the solution be durable a
    9·1 answer
  • Im drinking coffee. and working on school and watching a show. Whos with me?
    9·1 answer
  • A company is acquiring a smaller firm and is setting up a new IT system in order to consolidate the data and assets of the acqui
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!