reading-notes

These are my reading notes for Code Fellows


Project maintained by taegorov Hosted on GitHub Pages — Theme by mattgraham

Table of Contents

Home

Reading Day 1

Reading Day 2

Read04

Read05

Read06a

Read08

Intro + Scripts - Notes

JavaScript allows you to make web pages more interactive by accessing and modifying the content and markup used in a web page while it is being viewed in a browser

JavaScript essentially allows us to give step-by-step instructions to a browser/computer, kind of like a recipe

Allows users to interact with elements of your website, and allows your website to change depending on certain events/conditions

Common versions of JavaScript that you’ll see on websites:

All of the above rely on the ability to:

Access the content of a page

Modify the content of a page

Program rules or instructions the browser can follow

React to events triggered by the user or browser

Writing a Script

Even if scripts might appear complicated to you now, they’re actually a simple set of instructions

Individual steps of a recipe might need to be broken down further. For example, when making spring rolls, “create peanut sauce” might have its own sub-instructions. Computers need this information

Vocabulary: The words that computers understand

Syntax How you put those words together to create instructions computers can follow

Use flowcharts for the tasks you want the computer to achieve!

Expressions + Operators - Notes

Expressions

Essentially 2 types of expressions:

  1. Assign a value to a variable
  2. Combine values of different variables to create another (single) variable

Operators

Depended on by expressions

Assignment Operator

color = 'red';

Arithmetic Operator

area = 5 * 10;

String Operator

greeting = 'Yo' + 'Timbo';

Comparison Operator

Cheese = 10 > 20;

Logical Operator

Cheese = (10 > 20) && (2<8>);

There are many arithmetic operators that you might recognize from math class, but some are doubled up (like ++ or --). Page 76 lists some of these operators

Functions - Notes

Functions combine statements together so you don’t have to keep reusing individual functions

Helps with code organization

Calling a function means you’re telling a function to do its own task.

…statements are not run until the function is called

Functions need info to perform their tasks. These are called parameters

Return values are when a function gives you an answer when you ask for it

Declaring Function Example

function userName() {

document.write('this is your username');

}

userName();

Other Notes

You can use parameters to have code do a task without knowing all the information up front. For example, you can have a function multiply height by width, then decide what numeric values height and width have later on