
In javascript, explain how to display the full text for days and months in a Date() object ?

The below-given program will obey the following rubrics:
- Creating an object of date.
- The day from the date can be retrieved from getDay() and month from getMonth() function but these values are numeric. So, in order to get them as a text, we need to create the arrays.
- Creating two arrays, one for weekday and second for the month and assigning values to the array elements.
- After that calling the objects to display the text data for the days and the months.
Program code:
//instantiating Date
var toDay = new Date();
//declaring array for the weekdays
var weekDay = [];
//assigning values to the array elements
weekDay[0]= "Sunday";
weekDay[1]= "Monday";
weekDay[2]= "Tuesday";
weekDay[3]= "Wednesday";
weekDay[4]= "Thursday";
weekDay[5]= "Friday";
weekDay[6]= "Saturday";
//declaring array for the months
var months = [];
//assigning values to the array elements
months[0]="January";
months[1]="February";
months[2]="March";
months[3]="April";
months[4]="May";
months[5]="June";
months[6]="July";
months[7]="August";
months[8]="Spetember";
months[9]="October";
months[10]="November";
months[11]="December";
//displaying day and month in the text form
document.write(weekDay[toDay.getDay()] + " ")
document.write (months[toDay.getMonth()] + " ")
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images

- Write JavaFX code with an intuitive GUI design that can generate a Fibonacci number sequence of a certain length (e.g., 30-50 numbers) via pressing a ‘Fib Gen’ button. The program should have at least two filtering functions on the generated number sequence.arrow_forwardPlease solve this in java, using the Gui system(Jframe, Jpanel, etc) from java, not java fx thanks.arrow_forwardImplement a date picker in javafx having following properties1) only numerical value can be typed in it2) / ( forward slash) appears in it when form prompt and user can write date in it3)only 8 digits can be typed in itarrow_forward
- Find a way to increase the value of X by 10 while processing a game object in JavaScript?arrow_forwardWrite a JAVA program that prompts the user to enter the x- and y-position of a center point and a radius, using text fields. When user click on the “Draw” button, draw a circle with the given center and radius in a component.arrow_forwardHow to implement the below code snippet in Simple Javascriptarrow_forward
- Create a JAVA user interface for a calculator that performs only multiplication and division. It should contain ON, OFF, and clear buttons.arrow_forwardHow could I resize an image on Java. I'm using JGRASParrow_forwardIn javascript, List all the odd integer numbers between 1 and 100 that are multiples of 3. Each two consecutive numbers are separated by a space.arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





