Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript week day name

let weekday = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'][new Date().getDay()]
document.write(weekday)
Comment

day of week javscript

const weekday = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];

const d = new Date();
let day = weekday[d.getDay()];
alert(day);
Comment

javascript get date of the week

//Grab day of the week from local computer
let date = new Date();
let dayOfWeekNumber = date.getDay();
let nameOfDay;
let quote;

switch(dayOfWeekNumber){
    case 0: 
        nameOfDay = 'Sunday';
        quote = 'Time to chillax!';
        break;
    case 1:
        nameOfDay = 'Monday';
        quote = 'Monday morning blues!';
        break;
    case 2:
        nameOfDay = 'Tuesday';
        quote = 'Taco Time!';
        break;
    case 3:
        nameOfDay = 'Wednesday';
        quote = 'Two more days to the weekend.';
        break;
    case 4:
        nameOfDay = 'Thursday';
        quote = 'The weekend is almost here...';
        break;
    case 5:
        nameOfDay = 'Friday';
        quote = 'Weekend is here!';
        break;
    case 6:
        nameOfDay = 'Saturday';
        quote = 'Time to party!';
        break;

}
//Display the day of the week
let weekdayDiv = document.getElementById('weekday');
weekdayDiv.innerHTML = `${nameOfDay}`;

//Display quote
let quoteDiv = document.getElementById('phrase');
quoteDiv.innerHTML = `${quote}`


Comment

PREVIOUS NEXT
Code Example
Javascript :: remove null values from json object in javascript 
Javascript :: jquery fadein 
Javascript :: jquery clone and append 
Javascript :: eslint ignore current line 
Javascript :: find year javascript 
Javascript :: how to get id from url in javascript 
Javascript :: javascript get cookie 
Javascript :: valid json return null on json_decode 
Javascript :: sum an array in javascript 
Javascript :: javascript grab only even array index 
Javascript :: japan 
Javascript :: javascript go to url 
Javascript :: run js function after some sec 
Javascript :: input pattern for np whitespaces at the end or beginning 
Javascript :: JS node instal fs 
Javascript :: check if somethin exist in an object js 
Javascript :: jquery trigger 
Javascript :: react load different .env for local, dev, and prod 
Javascript :: vanilla javascript remove data attribute 
Javascript :: react chrome get language 
Javascript :: js set get first value 
Javascript :: react map 
Javascript :: javascript prompt for download location 
Javascript :: create new angular component command 
Javascript :: express serve static files 
Javascript :: environment varriables with vite 
Javascript :: invalid chai property 
Javascript :: how to exclude a specefic tagname from a javascript query search 
Javascript :: trigger ctrl + p or print page with javascript 
Javascript :: tostring javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =