Would anybody help me to sort out the day? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Would anybody help me to sort out the day?

var year = 1993; var month = 7; var day = 12; console.log(getWeekDay(year, month, day)); } function getWeekDay(year, month, day) { var names = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var date = new Date(year, month, day); var day = date.getDay() return names[day]; };

30th Nov 2022, 11:30 AM
Sony
Sony - avatar
9 Answers
+ 3
You need to put it in the tab next to the task description. Then click Result.
30th Nov 2022, 2:01 PM
Lisa
Lisa - avatar
+ 2
Which error do you get?
30th Nov 2022, 1:52 PM
Lisa
Lisa - avatar
+ 1
Your code is incomplete. People are more likely to test your code if you LINK it so they can run it on the sololearn code playground. Note that the numbers for the months start from 0, not from 1.
30th Nov 2022, 12:28 PM
Lisa
Lisa - avatar
+ 1
So what is the issue? Your code is incomplete. The 1st line is missing.
30th Nov 2022, 12:40 PM
Lisa
Lisa - avatar
0
Thanks for your support.. yeah.. I know it well about that 0 to 11 consists with.. a year. here 12 is no of day of the month.. Well I just mentioned the question.. no way to share the link of sololearn topic as you asked .. The program you are given takes year, month and day as input. Create a function that takes them as arguments and returns the corresponding day of the week. Sample Input 1993 7 12 Sample Output Thursday
30th Nov 2022, 12:34 PM
Sony
Sony - avatar
0
Here is the actual codes.. function main() { var year = parseInt(readLine(), 10); var month = parseInt(readLine(), 10); var day = parseInt(readLine(), 10); console.log(getWeekDay(year, month, day)); } function getWeekDay(year, month, day) { var names = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var d = new Date(year, month, day); //complete the function var day = d.getDay(); return names[day]; }
30th Nov 2022, 1:39 PM
Sony
Sony - avatar
0
When I'm going to print it using console.. there is nothing to see except the blank screen..
30th Nov 2022, 1:56 PM
Sony
Sony - avatar
0
I've already tried it.. .. even I've functioned it by myself... Changing values.. methods.. too..
30th Nov 2022, 2:03 PM
Sony
Sony - avatar
0
Thank you.. it's done! var year = 1993; var month = 7; var day = 12; console.log(getWeekDay(year, month, day)); function getWeekDay(year, month, day){ var names = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var d = new Date(year, month, day); var day = d.getDay(); return names[day]; }
1st Dec 2022, 5:28 AM
Sony
Sony - avatar