Question 11

Refer to code below:
Let first = 'who';
Let second = 'what';
Try{
Try{
Throw new error('Sad trombone');
}catch (err){
First ='Why';
}finally {
Second ='when';
} catch (err) {
Second ='Where';
}
What are the values for first and second once the code executes ?
  • Question 12

    Refer to the code below:
    Const myFunction = arr => {
    Return arr.reduce((result, current) =>{
    Return result = current;
    }, 10};
    }
    What is the output of this function when called with an empty array ?
  • Question 13

    The developer wants to test this code:
    Const toNumber =(strOrNum) => strOrNum;
    Which two tests are most accurate for this code?
    Choose 2 answers
  • Question 14

    Given the code below:
    const copy = JSON.stringify([ new String(' false '), new Bollean( false ), undefined ]); What is the value of copy?
  • Question 15

    A developer is creating a simple webpage with a button. When a user clicks this button for the first time, a message is displayed.
    The developer wrote the JavaScript code below, but something is missing. The message gets displayed every time a user clicks the button, instead of just the first time.
    01 function listen(event) {
    02 alert ( 'Hey! I am John Doe') ;
    03 button.addEventListener ('click', listen);
    Which two code lines make this code work as required?
    Choose 2 answers