Skip to content

Instantly share code, notes, and snippets.

@kwhinnery
Last active April 11, 2016 18:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwhinnery/11270217 to your computer and use it in GitHub Desktop.
Save kwhinnery/11270217 to your computer and use it in GitHub Desktop.
Resources for the Geekettes JavaScript Workshop - http://bit.ly/geekettesjs - follow live at http://codepen.io/kwhinnery/professor/EaYBbZ/

Getting Started with JavaScript and Web Technologies

Today, we'll be working to understand how to create a web page using the technologies of the web browser, namely HTML, CSS, and (mostly) JavaScript.

Reference Resources

Arguably the best resource for documentation on the "web platform" (HTML, CSS, and JavaScript) is found on the Mozilla Developer Network. Here are the technologies we will be using:

Hypertext Markup Language (HTML)

HTML defines the structure and contents of a web page. Use HTML tags to display content on a web page.

Overview | Beginner's Guide | Full Reference Documentation

Cascading Style Sheets (CSS)

CSS defines the style and presentation of a web page. Use CSS to define how HTML elements look.

Overview | Beginner's Guide | Full Reference Documentation

JavaScript

JavaScript defines the behavior of a web page. Use JavaScript to react to mouse clicks and other user interactions.

Overview | Beginner's Guide | Full Reference Documentation

Exercises

All of these exercises can be done with a simple text editor and a web browser, and are designed to teach programming fundamentals and the basic concepts of web development. Go at your own pace!

Exercise 1: Hello HTML!

On your computer, create a new folder. Inside that folder, create a file called workshop.html. Inside of it, create a basic HTML document with an <html> tag and a <body> tag. Inside the <body>, sing the <h1> tag.

Exercise 2: Pretty CSS is Pretty

In the file you just created, create a <style> tag. Inside this tag, create a CSS rule for <h1> tags such that they should all have red text.

Exercise 3: Your First JavaScript

In workshop.html, create a <script> tag. This will contain JavaScript code that will run when your web page is loaded. Write a script that will add "Hello from JavaScript!" to the bottom of the page.

HINT: the JavaScript function for writing to the page is document.write('Hello from JavaScript!');

Exercise 4: Variables, Statements, and Object Literals

Modify your script to create five variables - a String, a Number, a Boolean, an Array, and an Object. Use document.write to prin the contents of all of them to the page.

Exercise 5: Do The Math (Operators)

Create two number variables. Multiply them together, and print out the result to the page with document.write.

Exercise 6: Conditionals

Create a Boolean variable. If it is false, print out "it's false". If it's true, print out "it's true". Change the variable from true, to false, to true again to test that it works!

Exercise 7: While Loop

Create a number variable. While it is less than 50, print out the current value of the variable, then add one to the variable.

Exercise 8: For Loop

Create an array of names. For each element of the array, print out the name.

Exercise 9: Functions

Create a function that accepts one argument, a number. Add five to that number and return the result.

Exercise 10: DOM Event Handling

Create a function that displays an alert dialogue using the alert() function that is built in to JavaScript. Assign it to be executed when the <h1> tag is clicked.

Further Reading and Resources

Books

Websites

  • Codecademy: Accessible tutorials for JavaScript, HTML, CSS and many programming languages
  • Code Combat: Learn JavaScript by playing a game

Tools and Technologies

Programming Text Editors

  • CodePen: Web page to play around with HTML, CSS, and JavaScript
  • JSFiddle: Web page to play around with HTML, CSS, and JavaScript
  • Sublime Text: Cross-platform text editor
  • Notepad++: Windows-only free text editor
  • TextMate 2: Mac-only text editor

Hosting

  • Site44: Host static web pages on Dropbox
  • Heroku: Hosting for full web apps (advanced, but arguably the easiest way to deploy dynamic web apps)

Advanced Tools and Debuggers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment