Skip to content

Latest commit

 

History

History
41 lines (24 loc) · 1.94 KB

File metadata and controls

41 lines (24 loc) · 1.94 KB

Whats JavaScript

JavaScript is programming language, it is used to enhance HTML pages and is commonly found with HTML codes

There are 4 ways to decalare with js variables.

  • Using let
  • Using var
  • Using const

Variables are containers for storing data (storing data values)

Variable let

If you think the value of the variable can change, use let.

variable Const

If you want a general rule: always declare variables with const.

variable var

If you working on old pages you can use var.

Control Flow

The control flow is the order in which the computer executes statements in a script. Code is run in order from the first line in the file to the last line, unless the computer runs across the (extremely frequent) structures that change the control flow, such as conditionals and loops.

The function could also include a loop, which iterates through all of the fields in the form, checking each one in turn. Looking back at the code in the if and else sections, the lines promptUser and submitForm could also be calls to other functions in the script

Java Funtion

A JavaScript function is a block of code designed to perform a particular task. A JavaScript function is executed when "something" invokes it (calls it).

Expression

t a high level, an expression is a valid unit of code that resolves to a value. There are two types of expressions: those that have side effects (such as assigning values) and those that purely evaluate. The expression x = 7 is an example of the first type. This expression uses the = operator to assign the value seven to the variable x. The expression itself evaluates to 7.

** Const x = 1 +2 * 3** ** const y = 3 * 2 + 1**

*They both equal 7 just worded diffrently. Despite * and + coming in different orders, both expressions would result in 7 because * has precedence over +, so the -joined expression will always be evaluated first.

Home