Right On Target

[Week 1 - TAAQUI GIPHY] · Lesson 5 · 6 minutes

We finish up our introduction to functions and get acquainted with APIs and why they're useful to us as developers.

So, knowing how to construct an if statement function, how do we get it to do the same thing as onGoBtnClicked? One option is simply copy/pasting the instructions from onGoBtnClicked, but there's a simple, elegant alternative: 


We can define the variable input as whatever the value is inside this function's target - the object element we're working with - which in this particular case is the .js-userinput object, aka our text field. 

Now that we're somewhat familiar with calling functions, it's time to call in something else entirely: an API. API stands for Application Programming Interface, and it's a way for big companies like Google or our case Giphy, open up their huge tracts of...data...to third party developers like ourselves. By accessing that data, aka all the GIFs, we can build things through javascript. 

Ask A Question

Having trouble? Don't worry, you're probably not the only one. Check out the questions other students have or ask yours.