In the browser, the window object is often used to assign variables that require the
broadest scope in an application Node.js application does not have access to the window
object by default.
Which two methods are used to address this ?
Choose 2 answers
A.
Use the document object instead of the window object.
B.
Assign variables to the global object.
C.
Create a new window object in the root file.
D.
Assign variables to module.exports and require them as need
Assign variables to the global object.
Refer to the code below:
Function Person(firstName, lastName, eyecolor) {
this.firstName =firstName;
this.lastName = lastName;
this.eyeColor = eyeColor;
}
Person.job = ‘Developer’;
const myFather = new Person(‘John’, ‘Doe’);
console.log(myFather.job);
What is the output after the code executes?
A.
ReferenceError: eyeColor is not defined
B.
ReferenceError: assignment to undeclared variable “Person”
C.
Developer
D.
Undefined
Undefined
Refer to the following code:
Let obj ={
Foo: 1,
Bar: 2
}
Let output =[],
for(let something in obj{
output.push(something);
}
console.log(output);
What is the output line 11?
A.
[1,2]
B.
[“bar”,”foo”]
C.
[“foo”,”bar”]
D.
[“foo:1”,”bar:2”]
[“foo”,”bar”]
The developer has a function that prints “Hello” to an input name. To test this, thedeveloper created a function that returns “World”. However the following snippet does not print “ Hello
World”.
What can the developer do to change the code to print “Hello World” ?
A.
Change line 7 to ) () ;
B.
Change line 2 to console.log(‘Hello’ , name() );
C.
Change line 9 to sayHello(world) ();
D.
Change line 5 to function world ( ) {
Change line 2 to console.log(‘Hello’ , name() );
A developer writers the code below to calculate the factorial of a given number.
Function factorial(number) {
Return number + factorial(number -1);
factorial(3);
What is the result of executing line 04?
A.
0
B.
6
C.
-Infinity
D.
RuntimeError
RuntimeError
Page 9 out of 45 Pages |
Previous |