What's the difference between an Interface and an API?
Published on:I used to think JavaScript doesn't have Interfaces because it doesn't have the Interface
keyword, unlike Java.
<Image src="/assets/2020/interface-vs-api/java-interface.png" caption="Interface keyword in Java" />
But JavaScript DOES have interfaces. I found out about this when I tried Googling for the location
API, which turned out to the location
Interface 🤦♂️.
<Image src="/assets/2020/interface-vs-api/location.png" alt="Location interface." />
I was confused. What the hell is the difference between an interface and an API? I sat down and figured it out (as usual). I want to share my newfound understanding with you in this article.
Let's begin with interfaces.