Skip to content

Latest commit

 

History

History
61 lines (48 loc) · 2.63 KB

File metadata and controls

61 lines (48 loc) · 2.63 KB

JAVA SCRIPT

SCRIPT :

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

  1. What is a script and how do I creat one?
  • A script is a series of instructions that the computer can follow in order to achieve a goal.
  • Each time the script runs, it might only use a subset of all the instructions.
  • Computers approach tasks in a different way than humans, so your instructions must let the computer solve the task prggrammatically.
  • To approach writing a script, break down your goal into a series of tasks and then work out each step needed to complete that task (a flowchart can help).
  1. DEFINE THE GOAL

First, you need to define the task you want to achieve. You can think of this as a puzzle for the computer to solve.

  1. DESIGN THE SCRIPT

To design a script you split the goal out into a series of tasks that are going to be involved in solving this puzzle. This can be represented using a flowchart.

  1. **CODE EACH STEP **

Each of the steps needs to be written in a programming language that the compu ter understands. In our case, this is JavaScript.

Note : Computers approach tasks in a different way than humans, so your instructions must let the computer solve the task prggrammatically.

EXPRESSIONS

  • An expression evaluates into (results in) a single value. Broadly speaking there are two types of expressions:
    • EXPRESSIONS THAT JUST ASSIGN A VALUE TO A VARIABLE.
    • EXPRESSIONS THAT USE TWO OR MORE VALUES TO RETURN A SINGLE VALUE.

OPERATORS

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

    • ASSIGNMENT OPERATORS: Assign a value to a variable.
    • ARITHMETIC OPERATORS: Perform basic math.
    • STRING OPERATORS: Combine two strings.
    • COMPARISON OPERATORS: Compare two values and return true or false.
    • LOGICAL OPERATORS: Combine expressions and return true or false.

    FUNCTIONS

    • Functions allow you to group a set of related statements together that represent a single task.
    • Functions can take parameters (informatiorn required to do their job) and may return a value.
    • An object is a series of variables and functions that represent something from the world around you.
    • In an object, variables are known as properties of the object; functions are known as methods of the object.
    • Web browsers implement objects that represent both the browser window and the document loaded into the browser window.
    • JavaScript also has several built-in objects such as String, Number, Math, and Date. Their properties and methods offer functionality that help you write scripts.