Understanding Compiled vs. Interpreted Code
By contrast, compiled languages require compilation or transformation into another form before the computer runs them. One example would be C++, as it must be compiled into an assembly language that the computer runs.
Understanding Client-Side vs. Server-Side Code
Server-side code runs within a server, with the results downloaded and displayed within the browser.
Alternatively, client-side code is what runs on the computer; when you visit a website, your browser downloads the client-side code, then runs and displays it.
Understanding Dynamic vs. Static Code
While static code always shows the same content, dynamic code updates content in real-time.
Third-party APIs usually put their information and code online, but they are not automatically built into your browser. Examples include OpenStreetMap API, Google Maps API and Twitter API. The first two let you do things such as embedding a custom map on your website while the latter lets you show your recent social media activity or perform similar actions.
Of course, this is just a small sampling of the various browser and third-party APIs.
To avoid any errors, be sure to define an object before referencing it.
Replace the <script> element in your current code with:
It has the same functionality as the above examples, but there is an inline “onclick” handler that runs the function when you click the <button>.
To get around this issue, programmers will sometimes add in constructs. For example: