Skip to content

Commit

Permalink
I have started adding the fruit Images and Names
Browse files Browse the repository at this point in the history
  • Loading branch information
Abbby1007 authored Aug 15, 2024
1 parent 970b772 commit c029742
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
Binary file added Ackee.png.webp
Binary file not shown.
Binary file added avocado.png.webp
Binary file not shown.
2 changes: 2 additions & 0 deletions banana.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ <h1> Random Jamacian Fruits Generator</h1>
<div id="result2"> </div>

<button onclick="banana()" id="generate"> Generate </button>

<a href="https://www.chefspencil.com/jamaican-fruits/"><button id="source"> Source of the Fruit Images</button> </a>
</div>

<script src="script.js"></script>
Expand Down
Binary file added bananas-1.png.webp
Binary file not shown.
13 changes: 8 additions & 5 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,19 @@ function newBubbleWrap(){


function banana(){
const bananaImages = [ 'Banana 1.jpg',`Single bubble.png`]
const bananaImages = [ 'Ackee.png.webp',`avocado.png.webp`, 'bananas-1.png.webp']

const selectedBanana = bananaImages[Math.floor(Math.random() * bananaImages.length)];

if(selectedBanana == "Banana 1.jpg"){
document.getElementById("result2").innerHTML = `Banana`;
if(selectedBanana == "Ackee.png.webp"){
document.getElementById("result2").innerHTML = `Ackee`;
}
else if (selectedBanana == "Single bubble.png"){
document.getElementById("result2").innerHTML = `Bubble Wrap`;
else if (selectedBanana == "avocado.png.webp"){
document.getElementById("result2").innerHTML = ` Avocado (Jamaican Pear)`;
}
else if (selectedBanana == 'bananas-1.png.webp'){
document.getElementById("result2").innerHTML = ` Banana`;
}


// document.getElementById('result').innerHTML = `<img src="Single bubble.png"`;
Expand Down

0 comments on commit c029742

Please sign in to comment.