Question: Add a new comment below the pic 1 ( ) function, followed by a new function named pic 2 ( ) . Carefully analyze the

Add a new comment below the pic1() function, followed by a new function named pic2(). Carefully analyze the pic1() function to understand the purpose of the four statements within the function. Use it as a guide to create the pic2() function. The pic2() function should display the sanjuan.jpg image, use Elevated view of San Juan coast for the img alt text, and use Coast of San Juan for the figcaption text.
```
File Name: script.js
Date: 11/06/2024
*/
var figElement = document.getElementById("placeholder");
var imgSource = document.getElementById("image");
var figCap = document.querySelector("figcaption");
//Function to display the first picture
function pic1(){
imgSource.src = "images/trunk-bay.jpg";
imgSource.alt = "Elevated view of Trunk Bay beach on St. John";
figElement.style.display = "block";
figCap.textContent = "Trunk Bay in St. John";
}
function pic2(){
imgSource.src = "sanjuan.jpg";
imgSource.alt = Elevated view of San Juan coast;
figElement.style.display = "block";
figCap.textContent = "Coast of San Juan";
```
Add a new comment below the pic 1 ( ) function,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!