wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

ITEW2 Midterm Long Quiz 1

Total questions: 2

Worksheet time: 30secs

Name
Class
Date
1.

How do you define an object literal with a name property and a greet method?

a)

let obj = { name: "John", function greet() { console.log("Hello"); } };

b)

let obj = { name: "John", greet: function() { console.log("Hello"); } };

c)

let obj = { name: "John", greet: () => console.log("Hello") };

d)

Both (b) and (c)

2.

What will the following code output?

let person = { name: "Alice", age: 25 };

console.log(person.job);

a)

undefined

b)

null

c)

Throws an error

d)

NaN