// Tip:
// you may need to use "document.write" to generate IMG tags
//
// Here are some funny Giphy IDs:
// ------------------------------
// njYrp176NQsHS
// l0MYGb1LuZ3n7dRnO
// NCPcywASJGggw
// Ww2z5AGayCwTSRkBMT
//
// Here is the URL structure that you may want to use:
// ---------------------------------------------------
// https://media.giphy.com/media/{GIPHY_ID}/giphy.gif
//
// A function is simply an "abstract program"
// a list of instructions that can be executed multple times
function showGif (giphyId) {
const imgUrl = `https://media.giphy.com/media/${giphyId}/giphy.gif`
document.write(`<img src="${imgUrl}" />`)
}
// This syntax is known as "arrow function"
// It is modern and it is cool :-) so you will find it quite
// often in modern tutorials and codebases.
const showGif2 = giphyId => {
const imgUrl = `https://media.giphy.com/media/${giphyId}/giphy.gif`
document.write(`<img src="${imgUrl}" />`)
}
// Now we can use the function as much as we want:
// NOTE: Normal functions and arrow functions are used
// the very same way.
showGif('njYrp176NQsHS')
showGif('l0MYGb1LuZ3n7dRnO')
showGif2('NCPcywASJGggw')
showGif2('Ww2z5AGayCwTSRkBMT')
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.