JavaScript

A quick introduction to JavaScript from JavaScript.com.

To get an overview of JavaScript, there are many tutorials available on the web - some are free, others are paid for. I recommend trying the free tutorial available on FreeCodeCamp.com.

https://www.freecodecamp.org/news/build-a-beginner-friendly-javascript-application/

For this course, it's not expected that you learn or even understand JavaScript. You can, if you wish, simply copy/paste the code and continue on. However, if you wish to be able to make subtle or even major changes to the code it's certainly something you should consider learning.

JavaScript is a language used to program the behaviour of web pages.

There are two ways to implement JavaScript programs, inline from within your HTML page or via an external .js file. Here are some callouts for JavaScript:

  • JavaScript can be placed inside the <head> or <body> of an HTML page.
  • When placed in an HTML page, JavaScript must start with a <script> tag and end with a </script> tag.

For the purposes of Teachable, it's not always practical to use external JavaScript (although we'll explore that option later in the course) so our scripts will be placed between <script></script> tags at various places in the Power Editor pages or in an HTML/Code block in a custom page, sales page or lecture.

This is a very simply JavaScript function that by itself actually doesn't do anything but assigning an "onClick" event to a button. The example will simply output "Hello World!" to the browsers debug console.

<script>
function helloWorld() {
    console.log("Hello World!");
    return;
}
</script>

Accessing Browser Debug Consoles

Chrome

CTRL + SHIFT + J

CMD + OPTION + J

Firefox

Ctrl + Shift + K

CMD + OPTION + K

Complete and Continue  
Discussion

0 comments