Answer to Question #176879 in HTML/JavaScript Web Application for adhi chinna

Question #176879

Update Pickup Point

Given a previous pickup point in the prefilled code, and updated pickup point

area, city as inputs, write a JS factory function with a method to update the pickup point.Input

  • The first line of input contains a string area
  • The second line of input contains a string city

Output

  • The output should be a single line containing the updated pickup point area and city separated by a space
1
Expert's answer
2021-04-07T12:12:02-0400
<!DOCTYPE html>
<html>
<head>
    <script>
  function createPickupPoint(area, city) {
    return {
        area: area,
        city: city,
        getPickupPoint() {
            // updated pickup point area and city separated by a space
            return area + ' ' + city;
        }
    }
    }
    //The first line of input contains a string area
    var area = prompt("Enter the area: ");
    //The second line of input contains a string city
    var city = prompt("Enter the city: ");
    var pickupPoint = createPickupPoint(area, city)
    console.log(pickupPoint.getPickupPoint());
    </script>
</head>
<body>
</body>
</html>

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