Question 16

At Universal Containers, every team has its own way of copying JavaScript objects. The code Snippet shows an implementation from one team:
Function Person() {
this.firstName = "John";
this.lastName = 'Doe';
This.name =() => (
console.log('Hello $(this.firstName) $(this.firstName)');
)}
Const john = new Person ();
Const dan = JSON.parse(JSON.stringify(john));
dan.firstName ='Dan';
dan.name();
What is the Output of the code execution?
  • Question 17

    Refer to the code below:
    Const searchTest = 'Yay! Salesforce is amazing!" ;
    Let result1 = searchText.search(/sales/i);
    Let result 21 = searchText.search(/sales/i);
    console.log(result1);
    console.log(result2);
    After running this code, which result is displayed on the console?
  • Question 18

    A developer receives a comment from the Tech Lead that the code given below has error:
    const monthName = 'July';
    const year = 2019;
    if(year === 2019) {
    monthName = 'June';
    }
    Which line edit should be made to make this code run?
  • Question 19

    Which javascript methods can be used to serialize an object into a string and deserialize a JSON string into an object, respectively?
  • Question 20

    Given the code below:
    Setcurrent URL ();
    console.log('The current URL is: ' +url );
    function setCurrentUrl() {
    Url = window.location.href:
    What happens when the code executes?