Answer to Question #196515 in HTML/JavaScript Web Application for sai

Question #196515

Input1

{'surname' : 'Jones', 'city': 'Los Angeles'}

{'dish': 'puddings'}

{'pet': 'Peter'}

Output1

Mr and Mrs Jones went to a picnic in Los Angeles with a boy and a pet Peter. Mrs Jones made a special dish "puddings"


function readLine() {

 return inputString[currentLine++];

}

/* Please do not modify anything above this line */

function main() {

 const father = JSON.parse(readLine().replace(/'/g, '"'));

 const mother = JSON.parse(readLine().replace(/'/g, '"'));

 const child = JSON.parse(readLine().replace(/'/g, '"'));

 /* Write your code here */ 

/* Please do not modify anything below this line */

 console.log(`Mr and Mrs ${family.surname} went to a picnic in ${family.city} with a boy and a pet ${family.pet}. Mrs ${family.surname} made a special dish "${family.dish}"`);

}


1
Expert's answer
2021-05-23T12:19:33-0400
"use strict";

function readLine() {
    return inputString[currentLine++];
}

/* Please do not modify anything above this line */
function main() {
    const father = JSON.parse(readLine().replace(/'/g, '"'));
    const mother = JSON.parse(readLine().replace(/'/g, '"'));
    const child = JSON.parse(readLine().replace(/'/g, '"'));

    /* Write your code here */
    const family = {
        "surname": father.surname,
        "city": father.city,
        "pet": child.pet,
        "dish": mother.dish
    }

    /* Please do not modify anything below this line */
    console.log(`Mr and Mrs ${family.surname} went to a picnic in ${family.city} with a boy and a pet ${family.pet}. Mrs ${family.surname} made a special dish "${family.dish}"`);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS