JavaScript Prework

Pre-work for JavaScript

Remember learning HTML and CSS? To refresh your memory:

  • HTML is the markup language that we use to structure and give meaning to our web content, for example defining paragraphs, headings, and data tables, or embedding images and videos in the page.
  • CSS is a language of style rules that we use to apply styling to our HTML content, for example setting background colors and fonts, and laying out our content in multiple columns.

The third layer of standard web development is JavaScript.

  • JavaScript is a scripting language that enables you to create dynamically updating content, control multimedia, animate images, and pretty much everything else. (Okay, not everything, but it is amazing what you can achieve with a few lines of JavaScript code.)

Source: MDN: What is JavaScript?

Pre-work

Work through this W3Schools JavaScript Quickstart Tutorial to familiarize yourself with the basics of JavaScript. Be sure to click the Try it Yourself » button for each example to experiment with the code. You cannot break it; if your code stops working, refresh the browser tab to reset the example.

Answer the following in your notebook. We will revisit them in the lessons ahead.

Questions:

  1. What are 5 possible data types for JavaScript variables?
  2. How many numeric data types does JavaScript have?
  3. What is the name of the JavaScript method that finds an HTML element by its id attribute?
  4. True or False: JavaScript can change HTML content, attribute values, and styles (via CSS).
  5. True or False: JavaScript cannot show or hide HTML elements.

Coding Practice

Write code to complete each of the following tasks:

  1. Stores the length of the schoolName variable in a new variable called schoolLength.

    var schoolName = 'Turing School of Software and Design';

  2. Creates an object called person that stores your firstName, lastName, age, and city of residence.
  3. Creates an array called states that includes your home state and all bordering states. Feel free to use this map for reference.
  4. A function that takes two arguments and returns the sum.

Lesson Search Results

Showing top 10 results