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

Question #176883

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-08T07:26:32-0400
<!DOCTYPE html>
<html>
<head>


    <script>
  function updatePickupPoint(area, city) {
    return {
        area: area,
        city: city,
        getPoint() {
            return area + ' ' + city;
        }
    }
    }
    var area = prompt("Enter the area: ");
    var city = prompt("Enter the city: ");
    var pp = updatePickupPoint(area, city)
  
    window.onload = function() {
     document.getElementById("getPoint").innerHTML =pp.getPoint(); 
    
    };
    </script>
</head>
<body>
    <p id="getPoint"></p>
</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