[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.