reading-notes

Class 7

Back to home page

In this class, we looked into Programming with JavaScript.

Control flow- this is how a computer executes statements from the first line of code and down to the bottom unless interupted by Control Structures that change the flow like conditonals or loops.

Javascript funtions are blocks of code designed to perform a specified task and is executed when a structure calls it.

Control structures are very common for javascript and include structures like conditionals, loops and functions.

What is a Function?

Functions are made by writing the “function” keyword and a name, then adding parrentheses. () parameters are placed inside the parrentheses. The benefit of functions is you can use the Return feature to return previously used code to use again. you can also invoke or call functions multiple times.

function name(parameter1, parameter2, … ) {

// code to be executed

}

When the function is invoked(called) the code will activate.

Return statements will stop executing the function. This can be used to return text from a javascript command to a paragraph element (< p>) such as a calculation.

using () will invoke the function, without it it will return the function object and not the function result.

Javascript Operators