+ 1
I donât understand why it put syntax error, can you help me please ?
https://sololearn.com/compiler-playground/WbS4ROStFzzI/?ref=app Please help me, I try to make something that write the date of today in the middle, the date of the 2 previous day at left, and the date of the 2 next day at right The fact that all the five div does not enter in the body length is normal, my error is in the JavaScript code, in the jour function You can ask me question if you donât understand what a line of code is supposed to do, I didnât put any comment Thank you
7 Answers
+ 2
First of all you have problem with concatenation, your code:
idDate3.innerHTML = semaine[semaine3] +' ' jour3 +' ' + mois[mois3];
Should be:
idDate3.innerHTML = semaine[semaine3] +' ' +jour3 +' ' + mois[mois3]; (add a concatenation operator between jour3 and ' ')
Secondly, your entire JavaScript should be in the onload function
âwindow.onload = ()=>{
//your content
}â
else saving elements in those variables won't work as that code will be trying to find an element before the DOM is loaded
0
Ok, thank you so much !
0
It work now !
0
And also, try to update your codes to ES6 syntax, JavaScript developers don't use "+" for concatenation again... We use `
0
AREMU TAOFEEK there seem to be a law you've forgotten too, «if it works...», plus it's not like concatenation using â + â is abolished, I use it sometimes.đ
0
For sur but i havnt learn ES6 so far
0
IAmSupreme I know but it's good to be updated