What can we do with JavaScript?

- Access content. You can use JavaScript to select any element, attribute, or text from an HTML page.
- Modify Content. You can use JavaScript to add or remove elements , attribute, or text to the page.
- Program Rules. You can specify a set of steps for the browser to follow.
- React to Events. You can specify that a script should run when a specific even has occured.
Operators
Expressions* rely on things called operators; they allow programmers to create a single value from one or more values. Several arithmetic operations can be performed in one expression, but it is importantto understand how the result will be calculated. Multiplication and division are performed before addition or subtraction. This can affect the number that you expect to see. To illustrate this effect, look at the following examples.
WHAT IS A FUNCTION?
Functions let you group a series of statements together to perform a specific task. If different parts of a script repeat the same task, you can reuse the function (rather than repeating the same set of statements). and is a very helpfull it’s has many benefits:
- avoid duplicated.
- and it’s reusable (created ones and use it many times).
WRITING A SCRIPT:
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:
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.
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.
CODE EACH STEP: Each of the steps needs to be written in a programming language that the computer understands. In our case, this is JavaScript.