0

Hi. Please help someone to get answer.

var status=1; var mes; if(status==1) { mes="online"; } else { mes="away"; }

6th May 2020, 6:30 AM
Dev Sharma
Dev Sharma - avatar
4 odpowiedzi
+ 3
What's the problem here? If you want to print it then do- document.write(mes);
6th May 2020, 6:37 AM
Avinesh
Avinesh - avatar
+ 1
var status = 1; var mes; mes = document.getElementById('ab'); if (status == 1) { mes = mes.innerHTML= "online"; } else { mes = mes.innerHTML="away"; } Don't forget to add <p id="ab"></p> to HTML
6th May 2020, 7:19 AM
Kashyap Kumar
Kashyap Kumar - avatar
0
use the function document.write(mes) to get the answer.
6th May 2020, 7:17 AM
Dasarath Singh
0
Thanks avinesh and dasarath singh
6th May 2020, 7:18 AM
Dev Sharma
Dev Sharma - avatar