Short Course

Founders and Coders

Week 3: JavaScript

Recap from last week... 🍎


CSS

freeCodeCamp

DevTools

CodePen

Quiz time! 🎊


Head to https://kahoot.it


Check the Slack channel for the game pin

So, what exactly is JavaScript?

NounsAdjectivesVerbs

HTML: Nouns 🏠

Our HTML dictates what content will be on the page. It provides our basic structure

CSS: Adjectives 🎨

Our CSS describes how that content should look, how it should be laid out, and what styles it should have

JS: Verbs πŸƒβ€

And our Javascript brings that content to life - it allows the user to interact with the content, providing a dynamic experience and determining the behaviour of the page

HTML

CSS

JavaScript

What does JavaScript look like? πŸ‘€

Similarly to how CSS is executed within style tags, we can use script tags for Javascript.

Like so:

What does JavaScript look like? πŸ‘€


Normally, however, an HTML document will contain a script tag with a src attribute, which will provide the HTML with a link to a separate Javascript file.



                                        

A header element

Let’s see it in action! πŸ’ͺ


Open Google in your web browsers

freeCodeCamp πŸ•οΈ


Head to www.freeCodeCamp.org

Intro to Functions πŸ”§

What exactly is a function?


For our purpose, a function can be thought of as a tiny program


At the most basic level, a function is something that can be called, and will return to us a value.


A function can also take arguments, or parameters.

What does a Javascript function look like?


A function that does not take any arguments:


What does a Javascript function look like?

This is how we declare a function:


What does a Javascript function look like?

And this is how we call, or invoke a function:


Once more, here’s how we declare a function (think of this as how you create a function, and define what it does):



And how we invoke it:

Let's practice πŸ‘¨β€πŸ’» πŸ‘©β€πŸ’»

Head to https://repl.it/

Learn functions on freeCodeCamp πŸ•οΈ

Let's do this challenge together

Now try these these challenges


  • Write & run your code in Repl.it

  • Use console.log() to check that your functions are working

  • Take it in turns to type!

Homework 🍎


Continue working on freeCodeCamp 'Basic JavaScript' πŸš€

If you finish that (very long!) section, have a go at 'Basic Data Structures' and 'Basic Algorithm Scripting'

Thanks for coming!