0
How to write a javascript program to accept 1 to 7 numbers from user and display appropriate week of the days
3 Réponses
+ 1
Given code only accept a number between 1 to 7 and return day of week.
I hope you understand :)
https://code.sololearn.com/W9y24rFbl2v0/?ref=app
+ 7
In this way :-
const day = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var input = parseInt(prompt("Enter a number between 1 to 7"));
console.log(day[input-1])
+ 5
Take week days in to a array.
Take user input by prompt.. (1 to 7)
Display array[input-1]