Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

449
Views
How to combine day with string (text) in HTML with JavaScript

I am trying to combine a day with a string that says "this is the day" in html.

I tried this, it does not concatenate right.

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

it's better to use innerText if you don't insert html in your tag

moreover to get the weekday you can avoid stored weekday in an array and directly get it from data object

d.toLocaleString('en-us', {  weekday: 'long' })

const weekday = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; 
const d = new Date(); 
let day = weekday[d.getDay()];
let dayFromdate =  d.toLocaleString('en-us', {  weekday: 'long' });
document.getElementById("demo").innerText = "This is the day, "+ day; 
document.getElementById("demo2").innerText = "This is the day, "+ dayFromdate; 
<div id="demo"></div>
<div id="demo2"></div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!