reading-notes

View the Project on GitHub Abu-laban/reading-notes

THE ABC OF PROGRAMMING

** A script is a series of instructions that a computer can follow to achieve a goal. **

** To write a script, you need to first state your goal and then list the tasks that need to be completed in order to achieve it. **

Start with the big picture of what you want to achieve, and break that down into smaller steps.

  1. DEFINE THE GOAL

    First, you need to define the task you want to achieve.

  2. DESIGN THE SCRIPT

    To design a script you split the goal out into a series of tasks. This can be represented using a flowchart.

  3. CODE EACH STEP

    Each of the steps needs to be written in a programming language that the compu ter understands.

EXPRESSIONS

An expression evaluates into a single value. there are two types of expressions.

  1. EXPRESSIONS THAT JUST ASSIGN A VALUE TO A VARIABLE

    var color = ‘beige’;

  2. EXPRESSIONS THAT USE TWO OR MORE VALUES TO RETURN A SINGLE VALUE

    var area = 3 * 2;

OPERATORS

Expressions rely on things called operators; they allow programmers to create a single value from one or more values.

  1. ASSIGNMENT OPERATORS

    Assign a value to a variable color = ‘beige’;

  2. ARITHMETIC OPERATOR

    Perform basic math area = 3 * 2;

  3. STRING OPERATORS

    Combine two strings greeting= ‘Hi 1 + ‘Mol ly’;

  4. COMPARISON OPERATORS

    Compare two values and return true or false buy = 3 > 5;

  5. LOGICAL OPERATORS

    Combine expressions and return true or false buy= (5 > 3) && (2 < 4);

WHAT IS A FUNCTION?

A JavaScript function is a block of code designed to perform a particular task.

** Functions allow you to group a set of related statements together that represent a single task. **

** Functions can take parameters (information required to do their job) and may return a value. **

Functions1 Functions2