MCQs>IT & Programming>JavaScript MCQs>What's the output? var test = function (firstName, surname) { this.Name.FirstName = firstName; this.Name.Surname = surname; } test.prototype = { Name: { FirstName: undefined, Surname: undefined } } var b = new test('john', 'doe'); var c = new test('bob', 'templeton'); console.log(b.Name.FirstName + ' ' + b.Name.Surname + ', ' + c.Name.FirstName + ' ' + c.Name.Surname);
JavaScript MCQs
What is the output of the following JavaScript? var test = function (firstName, surname) { this.Name.FirstName = firstName; this.Name.Surname = surname; } test.prototype = { Name: { FirstName: undefined, Surname: undefined } } var b = new test('john', 'doe'); var c = new test('bob', 'templeton'); console.log(b.Name.FirstName + ' ' + b.Name.Surname + ', ' + c.Name.FirstName + ' ' + c.Name.Surname);
Answer
Correct Answer: bob templeton, bob templeton
Explanation:
Note: This Question is unanswered, help us to find answer for this one