JavaScript From Beginner To Advanced

0% completed

Previous
Next
Quiz
How do you create a new JavaScript object named car with properties make and model?
Choose all correct options
var car = Object("make", "model");
var car = new Object({make: "Toyota", model: "Corolla"});
var car = {"make": "Toyota", "model": "Corolla"};
var car = Object.create("make", "model");
What will the following code output?
var num = new Number(5);
console.log(typeof num);
A
number
B
object
C
Number
D
string
How do you find the largest number in the list [1, 3, 2]?
Choose all correct options
Math.max(1, 3, 2);
Math.max([1, 3, 2]);
Math.max.apply(null, [1, 3, 2]);
[1, 3, 2].max();
What does the following code log?
var date = new Date(2020, 0, 1);
console.log(date.getMonth());
A
0
B
1
C
"January"
D
Undefined
Which of the following is a correct way to add a new property color to an existing object car?
A
car.add("color", "blue");
B
car[color] = "blue";
C
car.color = "blue";
D
Both B and C are correct.
What is the result of the following code snippet?
console.log(Math.round(7.5));
A
7
B
8
C
7.5
D
NaN
Which statement will correctly parse the string "100" as an integer?
Choose all correct options
parseInt("100");
Number.parseInt("100");
String.toInt("100");
Both A and B are correct.

.....

.....

.....

Like the course? Get enrolled and start learning!
Previous
Next