Objects Flashcards

1
Q

Make the function display “Hello” in the inner HTML of an element with the ID “demo”.

A

document.getElementById(“demo”).innerHTML = “Hello”;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Add the following properties and values to the person object: firstName: John, lastName: Doe, country: Norway.

var person = {

};

A

firstName: “John”,
lastName: “Doe”,
country: “Norway”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Create an object called person with name = John, age = 50.

A
let person = {
name: "John", age: 50
};
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

access the object to alert(“John is 50”).

var person = {
   name: "John", age: 50
};
A

alert(person.name + “ is “ + person.age);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly