reading-notes

Reading Notes

View the Project on GitHub simon-panek/reading-notes

Code 102: Class 07 - Programming with JavaScript


Read: JavaScipt and JQuery Text pg 1-24

JavaScript used in browsers to make websites more interactive

Script a series of instructions a computer can follow to achieve a goal

Vocabulary words that computers understand

Syntax how teh words are put together to create instructions that computers can follow

Computers solve problems programmatically, following a series of instructions, one step after another

Read: JavaScript and JQuery Text pg 74-79

Expressions evaluate into a single value

Operators allow programmers to create a single value from one or more values

Arithmetic Operators JS contains the standard operators +, -, /, * which can be used with numbers as well as the following special operators

String Operator just one operator + used to join strings on either side

Mixing numbers and strings

Read: JavaScipt and JQuery Text pg 88-94

Functions allow programmer to group a series of statements together to perform a specific task

Declaring a Function give it a name and then write its statements needed to achieve its tasks inside the curly braces


function sayHello() {
    document.write('Hello!');
}

Calling a Function can execute all of the statements between a functions curly braces with just one line of code in the location that programmer desires

Declaring functions that need information give a function information by providing parameters


function getArea(width,height) {
    return width * height;
}

Calling a Function that nees information specify the values it should use in the () following the name, these values are called arguments


wallWidth = 3;
wallHeight = 5;
getArea(wallWidth,wallHeight);

Getting a single value out of a function “returning a result”


function calculateArea(width, height) {
    var area = width * height;
    return area;
}
var wallOne = calculateArea(3,5);
var wallTwo = calculateArea(8,5);

Note: when the interpreter hits the return command it goes back to the statemnt that called it, subsiqent statements in the function would not be processed


Return to reading-notes Deployed Site

Return to reading-notes Mark Down