Skip to main content

Forums

This topic contains 1 reply, has 2 voices, and was last updated by  Xiija 1 year, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #269840

    Pranab
    Participant

    I tried in the console Date.prototype.getDay and it return the correct getDay function. but after doing this Date.prototype.getDay(), it return error.
    Error is “Uncaught TypeError: this is not a Date object.”
    Why it’s giving error?

    #269845

    Xiija
    Participant
     var time = new Date();
     var wkday = [0,"sun",1,"mon",2,"tues",3,"wed",4,"thurs",5,"fri",6,"sat"]
     var check = time.getDay();
     console.log ( "today is " + wkday[check + 1] );
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

icon-link icon-logo-star icon-search icon-star