1: A expression is a set of numbers or script that boil down to one single value “expression”
2: Binding is a way to catch and hold values you want to keep.
3: An Environment is the landscape of the program as a whole where you keep your bindings and values stored in.
4: A function is a set of script of numbers going through a procedure to provide you with an expression outcome.
5: function toCelsius(fahrenheit) {
return (5/9) * (fahrenheit-32);
}
6: When a function changes another variable outside the scope of the function your working with.
7: console.log(prompt("pick a number)); tells the console the number you pick.
8: The order in which statements are exicuted in the program. it can be changed by logic branching and looping structures.
9: Logical test that shows the program which path to follow for numbers or scripts.
10: if and else keywords and its varients!
-
What is an expression?
This is the section of code that produces a value. -
What is a binding?
This is the concept where a variable is assigned a value, to temporarily hold on to. -
What is an environment?
This is the accumulation of bindings and values that currently exist. -
What is a function?
Function is a pre-defined programme what computes to a value. -
Give an example of a function.
prompt(“Give an example of a function:”); -
What is a side effect?
Side effect is a change that occurs in the environment that can be referenced. -
Give an example of a function that produces a side effect and another function that produces a value.
prompt(“Give an example of a function:”);
console.log(Math.max(2, 4));
-
What is control flow?
This is the top to bottom execution of code. -
What is conditional execution?
This is where the programme contain branches and the branch of code that is executed depends on certain criteria being met. -
What kind of keyword do you need to use to invoke conditional execution?
“if” statement
- What is an expression? An expression is a fragment of code which produces a value. There are 2 types of expression those with side effects which assign a value to a variable like x =7 and those that resolve to a value lie 2+3, this would result in 5 but it is not assigned to a variable
- What is a binding? A binding is an attachment to a value, for example let one =1, or var name = “Joe”. These values can change or be updated at any time. Binding names can be any word containing digits if desired but not start with a digit. Keywords cannot be used as names.
- What is an environment? This is a collection of bindings and their respective values which exist at a given time.
- What is a function? A function is a set of statements that perform a task or calculates a value. It takes an input and returns an output where there is a relationship betweenn them. To use a function you must define it somewhere. When the script reaches the return statement the function stopes executing
- Give an example of a function. Function myfunction(p1,p2) { return p1*p2; } This function will multiplicate p1 and p2 and return it.
- What is a side effect? A side effect assigns a value to a variable, shows things in the screen, writing to a file, make a http request, spawn a process, save data in a database, call other functions with side effects etc. Any action that can change the ‘state of the world’.
- Give an example of a function that produces a side effect and another function that produces a value. Value = console.log(Math.max(2, 4)); Side effect = function test() { alert{“This is a test message”) } test()
- What is control flow? Control flow is how a program executes statements from top to bottom in logical order.
- What is conditional execution? This is used when alternative route dependent on a certain condition. Using an if statement is an example of using the output of the condition to determine what to do next.
What kind of keyword do you need to use to invoke conditional execution? if
- What is an expression?
-A fragment of a code that produces a value. - What is a binding?
-it cathes and holds values of an expression - What is an environment?
-The collection of bindings and their values that exist at a given time. - What is a function?
- Its a piece of program wrapped in a value.
- Give an example of a function.
-prompt (“Enter password”); - What is a side effect?
When a function makes something else beside returning a value, like giving a writing text box in the screen for example. - Give an example of a function that produces a side effect and another function that produces a value.
Side Effect
prompt ("Enter Name: ");
Value
console.log. (Math.max (2,4)); - What is control flow?
The way a program is executed: From top to bottom, left to right. - What is conditional execution?
When a program takes the proper branch based on the situation at hand. - What kind of keyword do you need to use to invoke conditional execution?
If.
-
What is an expression?
A Javascript expression is a fragment of code that produces a value. -
What is a binding?
A Javascript binding is a variable, which catches and holds a value. -
What is an environment?
A collection of bindings and their values that exist at a given time is called an “environment” in Javascript. -
What is a function?
A Javascript function is a piece of code or program .wrapped in a value -
Give an example of a function.
prompt(“Enter your name:”); -
What is a side effect?
Functions may produce side-effects, such as producing a dialogue box or writing text to the console - an effect or output created by a function. -
Give an example of a function that produces a side effect and another function that produces a value.
Console.log produces a side-effect (text to screen), where Math.min returns a value (minimum number from a list of arguments). The following expression, using multiple functions, creates both side-effects and values:
console.log("The answer is " + (Math.max(12, 244, 13, 1000, 32, 1001) - Math.min(12, 13, 14, 15)));
-
What is control flow?
Control flow is the direction or path a program takes based on the logical order of the statements within the program. -
What is conditional execution?
Conditional execution occurs when the resulting output is created by the truth of one statement over another (or others). -
What kind of keyword do you need to use to invoke conditional execution?
If, Else, While, For, Do
-
What is an expression?
A fragment of code that produces a value is an expression. -
What is a binding?
A binding is provided by JavaScript in the form of a keyword to hold or catch a value. -
What is an environment?
An environment is a collection of bindings and their values that exist a given time. -
What is a function?
A function is a piece of program wrapped in a value. -
Give an example of a function.
alert(“I can’t wait to get into the blockchain industry”) -
What is a side effect?
Showing a dialogue box or writing to the screen is a side effect. -
Give an example of a function that produces a side effect and another function that produces a value.
- prompt(“Enter passcode”); makes a dialogue box appear and prompts you to enter a password within the dialogue box.
- console.log(Math.max(2, 4)); produce a value with no side effect.
-
What is control flow?
When your program contains more than one statement. The statements are executed as if they are a story, from top to bottom and this is an example of control flow. -
What is conditional execution?
Conditional execution is where the solution may not be as simple as taking the straight road, a branch of roads are created and by implementing conditional execution, the program takes the correct branch based upon the situation at hand. -
What kind of keyword do you need to use to invoke conditional execution?
The keyword i f is used if we want to use conditional execution.
- What is an expression? A piece of code that produces a value.
- What is a binding? A binding is where a value or string (A) is bound to another value or string (B) by using an = operator and an expression. Once the binding has been defined , it’s name can be used as an expression. The value of the expression (B) is the value the binding currently holds (A). When a binding points to a value, it does n’t mean that it is tied to that value forever.
- What is an environment? A n environment is the collection of bindings & their values that exist at a given time.
- What is a function? A function is a piece of program wrapped in a value.
- Give an example of a function.
var x = prompt(“Enter the value of x”);
console.log(x);
-
What is a side effect? A side effect is where a dialog box or writing text to the screen is shown.
-
Give an example of a function that produces a side effect and another function that produces a value.
BQ = window.prompt (“Input bread quantity”,”0”);
Produces a dialog box asking you to input t he quantity of bread you’d like .
Console.log(22);*
Produces a value of 4
- What is control flow? When there is more than one statement in a program, it executes each statement from top to bottom.
- What is conditional execution? Is where the program executes the code that is specific to the situation.
- What kind of keyword do you need to use to invoke conditional execution? IF
1- A part of the code that produces a value.
2- A binding is a variable.
3- It is a collection of bindings and their values that exist at a given time.
4- A function is a piece of program wrapped in a value.
5- a = b + c
6- It is whe a dialog box is showed or a writing text on a screen.
7- A side effect function, prompt(" hola "); a function that produces a vule is a= b+c.
8- Control flow exists when there is more than 1 statement. it is like a story from top to bottom.
9- It is created with the if word, the code is executed only when the condition is met.
10- if
1.A fragment of code that produces a value is called an expression
2. To catch and hold values, JavaScript provides a thing called a
binding, or variable
3.The collection of bindings and their values that exist at a given time is called
the environment
4.A lot of the values provided in the default environment have the type function.
A function is a piece of program wrapped in a value
5.Console.log(5+5);
6. Showing a dialog box or writing text to the screen is a side effect. A lot of
functions are useful because of the side effects they produce
7.alert(hello) is an side effect
console.log(math.max(2, 4));
–4 is an returns a value
8. the order that the statements are executed from top to bottom
9Conditional execution is created with the if keyword in JavaScript. In the
simple case, we want some code to be executed if, and only if, a certain condition
holds.
- Fragment of code that produces value
- Link between one value to another
- Collection of bindings and values
- Piece of program wrapped in a value
- console.log
- Showing a dialog box or writing text to the screen
- Order of code execution
- if
- What is an expression? An expression is any valid set of literals, variables, operators, and expressions that evaluates to a single value. The value can contain a number or a string etc.
- What is a binding? to bindings can point to the same value, they are explained like tentacles and they’re like reaching for information.
- What is an environment? its a sample of bindings and their values in a given time.
- What is a function? it’s a execution that can be called as a function wrapped/closed in a value.
- Give an example of a function. prompt(“How is your day going?”);
- What is a side effect? it’s a dialogue-box or a writing text to the screen executes a side-effect.
- Give an example of a function that produces a side effect and another function that produces a value.
side effect: console.log (a);
value: let a = 100;
- What is control flow?
Control- flow ensures that statements are executed in the proper order - What is conditional execution? Conditional execution is when a block of code is executed only if a condition is met
- What kind of keyword do you need to use to invoke conditional execution? 1. “If” is the keyword
What is an expression?
An expression is a line of code that produces or changes a value. It may also produce or change a state (true, false).
What is a binding?
A binding is the way we can create an element with a value attached. And just for information, if we create an element without value and we request it’s value we’ll get undefined.
What is an environment?
The environment is the initial setup, where bindings are loaded and defined, at the start of our program.
What is a function?
A function is a way to simplify and reduce the complexity of the program. We can write a piece of code, wrap it in brackets and name it - binding a name to the function allow us to call it whenever we want, without having to write it.
Give an example of a function.
As examples of embeded functions in JavaScript we have:
- prompt("Text here");
- console.log( );
What is a side effect?
A Side Effect is anything that is produced from a function, whether it is writing text on the screen or console, or popping-up a menu or alert box.
Give an example of a function that produces a side effect and another function that produces a value.
Using examples from the book we have:
- Side Effect: prompt(“Enter Passcode”);
*Produces a Value: console.log(Math.min(2,4)+100);
What is control flow?
Control Flow, as the name states, is the order by the program is executed, from Top to Bottom.
What is conditional execution?
Conditional Execution is when we have several conditions along the Control Flow, that give us several outputs or conditions.
What kind of keyword do you need to use to invoke conditional execution?
We can use IF { } or IF { } ELSE { }
-
An expression is something that produces a value, it be a string or a number
-
A binding is a way for a variable to hold or catch a value that can fluid. It is not permanent and can be shifted from one value to another
-
It is a collection of values and their bindings at a given time, this is what we call an environment. It is what is present when a program starts
-
It is a type of program that is wrapped in a value
-
function addTwoNumebrs(x,y) {
return x + y
}addTwoNumbers(2,3)
5 -
Sowing a dialogue box or forcing a user to type something in the console is a side effect.
-
function greetPerson() {
var name = prompt(“what is your name?”)
console.log("Hi " + name)
} -
With multiple statements the program will be executed from top to bottom
-
A statement is executed only if the specified conditions are met
-
an if statement
-
What is an expression?
Its fragment of code which returns a value. -
What is a binding?
Binding is when you want to point or reference to a value. Same as pointer in C lang.
We can recognize binding, if somewhere we will see “let”. Its not a box with values and things but
its line between them. We can also use var or const. -
What is an environment?
Its just collection of bindings and their values. -
What is a function?
Function has head with name, return value and input parameters.
After that, function has body with code and every if or something must contains return value.
Its like a box with IN and OUT. INs we have in head parameters and OUT is return value. Can be
string, int, list, table… -
Give an example of a function.
function float plus (int a, int b){
return a+b;
}
// I don´t know if function uses float or if I can use like that, but in other lang its possible. -
What is a side effect?
Something that we don’t want. -
Give an example of a function that produces a side effect and another function that produces a value.
If I can use my function in question 5, and replace float with int.
It causes that if I use numbers that aren’t divide with 2, it returns to me wrong value. -
What is control flow?
Direction of execution a code or program from top to bottom. -
What is conditional execution?
If, else, some deciding logic. If something then, if condition is not valid, we run the else statement. -
What kind of keyword do you need to use to invoke conditional execution?
If else
- What is an expression? - its a result of input operated values. Result of fragment of Code.
- What is a binding? - is comand that holds value until is changed! It could be form of “noon” , digit(single number) or result of computation(x+,*-,/,y);
- What is an environment? - its the added values, binding, expressions in the console for the given time.
- What is a function? - function is wraped values in form of expression. Executes surtain action with one comand and string text.
- Give an example of a function. - prompt(“pick an number”); console.log(number);
- What is a side effect? - is result expression of a function or binding.
- Give an example of a function that produces a side effect and another function that produces a value. Function producing side effect have to make change in the environment can be creating alert"Hello world" or more complex like console.log("your number is " + x+y); only value function is: let number1=1; its just single output value not a computation.
- What is control flow? - is the way comand order is executed. From Top to Bottom.
- What is conditional execution? - conditional execution is when expresson that can have difrent direction like fork depend on the expressed output.
- What kind of keyword do you need to use to invoke conditional execution? - to invoke conditional expresion you need to use keywords: if , else, else if.
[/quote]
-
What is an expression?
- A fragment of code that produces a value
-
What is a binding?
- “Binding” is another way of sayin “variable”. They catch and hold values.
- I like the tentacle analogy presented in the book
-
What is an environment?
- The collection of bindings and their values that exist at a given time
-
What is a function?
- a piece of program wrapped in a value
-
Give an example of a function.
- the binding
prompt
holds a function that shows a little dialog box asking for user input.
- the binding
-
What is a side effect?
- A noticeable change caused by an expression
-
Give an example of a function that produces a side effect and another function that produces a value.
-
alert
brings up a notification box as a side effect. -
Math.max
issa function that produces a value
-
-
What is control flow?
- The order in which statements r executed w/in an expression or program
- Flow is top to bottom
-
What is conditional execution?
- When a program has different paths to choose from during execution
-
What kind of keyword do you need to use to invoke conditional execution?
if
Can someone explain to me why this code don’t work? I onlt get the first prompt to appear then nothing…
let num = Number(prompt(“Pick a number”));
if (num > 10) {
console.log(“Small”);
} else if (num < 100) {
console.log(“Medium”)
} else (num > 100) {
Console.log(High)
}
Regards
Jimmy
-
A fragment of code that produces a value.
-
Bindings is when you reference a value.
-
The collection of bindings and their values that exist at a given time.
-
A piece of program wrapped in a value.
-
function myFunction() {
console.log(“Hello, world!”)
} -
Showing a dialog box or writing text to the screen.
-
alert(“This is a side effect”)
console.log(Math.max(2, 4)); -
The program executes code from top to bottom.
-
When the code is executed if a certain condition holds.
-
if, else if, else
- An expression is any valid set of literals, variables, and operators that produces a value. Expressions can also simply be declared to have a value.
- Binding is like variable, they catch and hold a value.
- Environment is the collection of bindings and their values that exist at a given time.
- A function is a piece of program wrapped in a value.
- var x = prompt(“Enter the value of x”);
- Showing a dialog box or written text to the screen is a side effect.
- Side Effect example - prompt(“Enter passcode”);
Function example - console.log(Math.min(2, 4) + 100); - When your program contains more than one statement, the statements are
executed as if they are a story, from top to bottom. - Conditional execution is when a program takes the proper branch based on the situation instead of the story mode top to bottom.
- When the if or only if keywords are executed.
-
What is an expression?
fragment of code that produces value -
What is a binding?
binding holds value -
What is an environment?
The collection of bindings and their values that exist at a given time -
What is a function?
A function is a piece of program wrapped in a value. -
Give an example of a function.
prompt(“Enter passcode”); -
What is a side effect?
Showing a dialog box or writing text to the screen is a side effect -
Give an example of a function that produces a side effect and another function that produces a value.
prompt(“Pick a number”);
console.log(math.max(2, 5, 10)); -
What is control flow?
When the program contains more than one statement, the statements are
executed as if they are a story, from top to bottom -
What is conditional execution?
we want some code to be executed if, and only if, a certain condition
holds -
What kind of keyword do you need to use to invoke conditional execution?
if