Question 31
Refer to the following object.
```javascript
02 const dog = {
02 firstName: 'Beau',
03 lastName: 'Boo',
04 get fullName() {
05 return this.firstName + ' ' + this.lastName;
06 }
07 };
How can a developer access the fullName property for dog?
```javascript
02 const dog = {
02 firstName: 'Beau',
03 lastName: 'Boo',
04 get fullName() {
05 return this.firstName + ' ' + this.lastName;
06 }
07 };
How can a developer access the fullName property for dog?
Question 32
Refer to the code below:
01 <html lang="en">
02 <table onclick="console.log('Table log');">
03 <tr id="row1">
04 <td>Click me!</td>
05 </tr>
06 </table>
07 <script>
08 function printMessage(event) {
09 console.log('Row log');
10 event.stopPropagation();
11 }
12
13 let elem = document.getElementById('row1');
14 elem.addEventListener('click', printMessage, false);
15 </script>
16 </html>
Which code change should be done for the console to log the following when "Click me!" is clicked?
Row log
Table log
01 <html lang="en">
02 <table onclick="console.log('Table log');">
03 <tr id="row1">
04 <td>Click me!</td>
05 </tr>
06 </table>
07 <script>
08 function printMessage(event) {
09 console.log('Row log');
10 event.stopPropagation();
11 }
12
13 let elem = document.getElementById('row1');
14 elem.addEventListener('click', printMessage, false);
15 </script>
16 </html>
Which code change should be done for the console to log the following when "Click me!" is clicked?
Row log
Table log
Question 33
Refer to the code snippet:
01 function getAvailableilityMessage(item) {
02 if (getAvailableility(item)) {
03 var msg = "Username available";
04 }
05 return msg;
06 }
What is the return value of msg when getAvailableilityMessage("newUserName") is executed and getAvailableility("newUserName") returns false?
01 function getAvailableilityMessage(item) {
02 if (getAvailableility(item)) {
03 var msg = "Username available";
04 }
05 return msg;
06 }
What is the return value of msg when getAvailableilityMessage("newUserName") is executed and getAvailableility("newUserName") returns false?
Question 34
A developer creates a simple webpage with an input field. When a user enters text in the input field and clicks the button, the actual value of the field must be displayedin the console.
Here is the HTML file content:
<input type =" text" value="Hello" name ="input">
<button type ="button" >Display </button> The developer wrote the javascript code below:
Const button = document.querySelector('button');
button.addEvenListener('click', () => (
Const input = document.querySelector('input');
console.log(input.getAttribute('value'));
When the user clicks the button, the output is always "Hello".
What needs to be done to make this code work as expected?
Here is the HTML file content:
<input type =" text" value="Hello" name ="input">
<button type ="button" >Display </button> The developer wrote the javascript code below:
Const button = document.querySelector('button');
button.addEvenListener('click', () => (
Const input = document.querySelector('input');
console.log(input.getAttribute('value'));
When the user clicks the button, the output is always "Hello".
What needs to be done to make this code work as expected?
Question 35
Given the code below:
Which three code segments result in a correct conversion from number to string? Choose 3 answers
Which three code segments result in a correct conversion from number to string? Choose 3 answers
