- An expression is a piece(fragment) of code that produces a value.
- Binding(of a variable) is a way the computer keeps its memory assigned as a tentacle(loose box) to the variable, which can later be used as an expression.
- An environment is a set of variables and their values that exist in memory at a given time.
- A function is a wrapped piece of Program with values, that performs/returns a specific task.
- an Example of a function is as Follows:
function cube(number) {
return number * number * number
}
console.log(cube(3));
another example:
let num = Number(prompt(âEnter a number of your choiceâ));
if (num <10) {
console.log(âThe number is smallâ);
}
else if (num 10 < 100){
console.log(âThe number is Mediumâ);
}
else {
console.log(âThe number is Bigâ);
}
-
The above two are examples of functions with side effects.
When functions return values using Invoked arguments(values) to allow the computer to compute(calculate) and arrive at values even outside the scope the function itself, then this is called a âSide effectâ
prompt(âAre you liking this Course?â);
this is producing no value outside the function.
function cube(number) {
return number * number * number
}
console.log(cube(3));
this is a function which is creating a value outside the scope of the Function.
-
Control Flow is the direction of execution of a code in JavaScript and it happens in a Top down approach.
-
Conditional Execution is a Branch of control Flowâs execution, where JS executes this Branch if some Parameters are present.
example
if (typeof web3 !== âundefinedâ)
else {alert(âCould not find Web 3.0 provider, Please visit metamask.io or download the Ethereum Mist Browserâ);
} -
If, Else if, Else, Switch