<< Prev Question Next Question >>

Question 5/56

Refer to code below:
function Person() {
this.firstName = 'John';
}
Person.prototype ={
Job: x => 'Developer'
};
const myFather = new Person();
const result =myFather.firstName + ' ' + myFather.job();
What is the value of the result after line 10 executes?

Recent Comments (The most recent comments are at the top.)

org - May 09, 2024

Correct is actually A.
From the options you can see that it is myFather.job not Job, so the correct syntax should be:
function Person() {
this.firstName = 'John';
}
Person.prototype = {
job: x => 'Developer',
};
const myFather = new Person();
const result = myFather.firstName + ' ' + myFather.job();
console.log(result);

If we run the correct syntax, always if it was not purposely written Job, the output will be John Developer

jai dixit - Feb 08, 2022

correct answer is C.

tested with below code -

function Person() {
this.firstName = 'John';
}
Person.prototype ={
Job: x => 'Developer'
};
const myFather = new Person();
const result =myFather.firstName + ' ' + myFather.job();

LEAVE A REPLY

Your email address will not be published. Required fields are marked *

Question List (56q)
3 commentQuestion 1: Refer to following code block: Let array = [1, 2, 3, 4, 5, 6...
Question 2: A developer receives a comment from the Tech Lead that the c...
Question 3: developer removes the HTML class attribute from the checkout...
Question 4: A developer is setting up a new Node.js server with a client...
2 commentQuestion 5: Refer to code below: function Person() { this.firstName = 'J...
Question 6: Refer to the expression below: Let x = ('1' + 2) == (6 * 2);...
Question 7: A developer creates a class that represents a blog post base...
Question 8: is below: &lt;input type="file" onchange="previewFile()"&gt;...
Question 9: A developer implements and calls the following code when an ...
Question 10: Given two expressions var1 and var2. What are two valid ways...
Question 11: Cloud Kicks has a class to represent items for sale in an on...
Question 12: Refer to code below: Let a ='a'; Let b; // b = a; console.lo...
Question 13: A developer uses a parsed JSON string to work with user info...
1 commentQuestion 14: Refer to the following code: Let sampleText = 'The quick bro...
Question 15: Which statement accurately describes an aspect of promises?...
Question 16: Refer to the code snippet below: Let array = [1, 2, 3, 4, 4,...
Question 17: A developer creates a generic function to log custom message...
Question 18: developer creates a new web server that uses Node.js. It imp...
Question 19: Universal Container(UC) just launched a new landing page, bu...
Question 20: In which situation should a developer include a try .. catch...
Question 21: A developer has the function, shown below, that is called wh...
Question 22: Given the following code: document.body.addEventListener(' c...
Question 23: Given code below: setTimeout (() =&gt; ( console.log(1); ). ...
Question 24: Refer to the code below: function foo () { const a =2; funct...
Question 25: Refer to the code below: (Exhibit) Line 05 causes an error. ...
Question 26: Refer to the code below? Let searchString = ' look for this ...
Question 27: Refer to the following array: Let arr1 = [ 1, 2, 3, 4, 5 ]; ...
1 commentQuestion 28: Which three actions can be using the JavaScript browser cons...
Question 29: Refer to code below: Function muFunction(reassign){ Let x = ...
Question 30: Which function should a developer use to repeatedly execute ...
Question 31: A developer wants to use a module named universalContainersL...
Question 32: Refer to the code below: const event = new CustomEvent( //Mi...
Question 33: Given HTML below: &lt;div&gt; &lt;div id ="row-uc"&gt; Unive...
Question 34: Refer to the code below: (Exhibit) What is the value of resu...
Question 35: Which three options show valid methods for creating a fat ar...
Question 36: developer is trying to convince management that their team w...
Question 37: A class was written to represent items for purchase in an on...
Question 38: A developer is asked to fix some bugs reported by users. To ...
Question 39: The developer wants to test this code: Const toNumber =(strO...
Question 40: A developer creates an object where its properties should be...
1 commentQuestion 41: Which option is true about the strict mode in imported modul...
Question 42: A developer is debugging a web server that uses Node.js The ...
1 commentQuestion 43: Refer to the code snippet below: Let array = [1, 2, 3, 4, 4,...
Question 44: A developer is required to write a function that calculates ...
Question 45: Refer to the code below: Function changeValue(obj) { Obj.val...
Question 46: Given the JavaScript below: 01 function filterDOM (searchStr...
Question 47: A developer wants to leverage a module to print a price in p...
Question 48: Refer to the following object: const cat ={ firstName: 'Fanc...
Question 49: Which two console logs outputs NaN ? Choose 2 answers...
Question 50: Given the following code: document.body.addEventListener(' c...
Question 51: Refer to the code below: console.log(''start); Promise.resol...
Question 52: Why would a developer specify a package.jason as a developed...
Question 53: Which statement parses successfully?...
Question 54: A developer has an ErrorHandler module that contains multipl...
Question 55: A developer is wondering whether to use, Promise.then or Pro...
Question 56: developer publishes a new version of a package with new feat...