JavaScript-Developer-I Exam Question 51

Refer to the code below:
01 let first = ' Who ' ;
02 let second = ' What ' ;
03 try {
04 try {
05 throw new Error( ' Sad trombone ' );
06 } catch (err) {
07 first = ' Why ' ;
08 throw err;
09 } finally {
10 second = ' When ' ;
11 }
12 } catch (err) {
13 second = ' Where ' ;
14 }
What are the values for first and second once the code executes?
  • JavaScript-Developer-I Exam Question 52

    Corrected code:
    let obj = {
    foo: 1,
    bar: 2
    };
    let output = [];
    for (let something in obj) {
    output.push(something);
    }
    console.log(output);
    What is the output of line 11?
  • JavaScript-Developer-I Exam Question 53

    Refer to the following code:
    01 class Ship {
    02 constructor(size) {
    03 this.size = size;
    04 }
    05 }
    06
    07 class FishingBoat extends Ship {
    08 constructor(size, capacity){
    09 //Missing code
    10 this.capacity = capacity;
    11 }
    12 displayCapacity() {
    13 console.log( ' The boat has a capacity of ${this.capacity} people. ' );
    14 }
    15 }
    16
    17 let myBoat = new FishingBoat( ' medium ' , 10);
    18 myBoat.displayCapacity();
    Which statement should be added to line 09 for the code to display
    The boat has a capacity of 10 people?
  • JavaScript-Developer-I Exam Question 54

    Refer to the code below:
    01 function myFunction(reassign) {
    02 let x = 1;
    03 var y = 1;
    04
    05 if (reassign) {
    06 let x = 2;
    07 var y = 2;
    08 console.log(x);
    09 console.log(y);
    10 }
    11
    12 console.log(x);
    13 console.log(y);
    14 }
    What is displayed when myFunction(true) is called?
  • JavaScript-Developer-I Exam Question 55

    Given two expressions, exp1 and exp2, which two valid ways return the logical AND of the two expressions and ensure it is a Boolean?