0
How can I display some properties of this variable?
I am new to Javascript and this is why I got stuck. I want to display some properties of the variable name through id
4 Respuestas
0
//Here is my code.
var person = {
firstName: "Jane",
age: 20,
sex: "Female",
};
// I used this to display some properties
document.getElementById("demo).innerHTML = person.name + " is" + person.age + "years old",
0
you need at least to close the "demo" string (missing closing quote)...
you must have an element with id="demo" to be able to select it, and the code need to have been parsed before trying to access it with js ^^
0
visph i have that in the html
Something like this:👇
<h1 id="demo"> </h1>
0
ok.
you must close thr "demo" string, and be sure that your code run when your <h1 id="demo"> have been parsed ^^