- What is a variable in JavaScript, and how do you create one?
- How do you initialize a variable?
- What is the difference between initialized and declared?
- What are the rules associated with naming a variable?
- What are the arithmetic operators in JavaScript, and what do they all do?
- What is concatenation, and what are the concatenation operators?
- What is the line of code used to prompt a user for a response?
- What is a function in JavaScript, and what do all functions have?
- What does calling a function do?
- What does it mean to pass a function arguments, and what does that do?
- What is the purpose of the return keyword in functions?
Reader Interactions
Comments
Leave a Reply
You must be logged in to post a comment.
Thao Hong says
What is a variable in JavaScript, and how do you create one?
– Variable means anything that can vary, and you use the reserved keyword var to declare a variable in JavaScript.
How do you initialize a variable?
– You add an equal sign (=) to the right of a variable name. to the right of the equal sign, write an expression
What is the difference between initialized and declared?
– If the value is not assigned to the Variable, then the process is only called a Declaration
What are the rules associated with naming a variable?
– A variable name can only have letters (both uppercase and lowercase letters), digits and underscore
What are the arithmetic operators in JavaScript, and what do they all do?
– They are addition (+), subtraction (-), multiplication (*), and division (/), and they take numerical values (either literals or variables) as their operands and return a single numerical value
What is concatenation, and what are the concatenation operators?
– Concatenation operators join multiple strings into a single string. There are two concatenation operators, + and &
What is the line of code used to prompt a user for a response?
– “prompt()”
What is a function in JavaScript, and what do all functions have?
– A function in JavaScript is similar to a procedure—a set of statements that performs a task or calculates a value, but for a procedure to qualify as a function, it should take some input and return an output where there is some obvious relationship between the input and the output
What does calling a function do?
– It can be used to invoke (call) a method with an owner object as an argument (parameter). With call() , an object can use a method belonging to another object
What does it mean to pass a function arguments, and what does that do?
– Means a function can be passed to another function as an argument. This allows the function being called to use the function argument to carry out its action
What is the purpose of the return keyword in functions?
– It ends the execution of a function, and returns control to the calling function
Bita Bagheeri says
Hi Thao,
I agree with your response to what a function is. To add on to that, a function also is a way to make your code easier to create, maintain and reuse. It organizes your code in this way.
Akhirah Miller says
Hi Thao,
I agree with your answers.
Brandon Lee says
Hi Thao! Great job answering the discussion post, you got straight to the point with all the necessary information. I like how you also explained that there is numerical values included in the arithmetic operations in JavaScript.
Satish Mishra says
Hello there, Thao.
I completely agree with you. A function in JavaScript is comparable to a procedure—a sequence of instructions that performs a task or calculates a value—but for a process to qualify as a function, it must accept some input and provide an output where the input and output have some clear relationship.
Olivia Jardel says
Thao,
Great explanation of the difference between initialization and declaration, as it was a little difficult for me to put into words.
Kevin Desouza says
for number 4, Variables can not start with a number.
Bita Bagheeri says
1. A variable is a value that can change depending on conditions. You can create one by using the keyword var to declare the variable.
2. You initialize a variable by adding the equal (=) sign after the variable name.
3. Initialization is when there is a value assigned to a value. Declaration is when there is no value assigned to a variable.
4. Variables can be as short or as long as you want. There are no spaces allowed. You can start with a letter, underscore, or the $ character; you cannot start with a number.
5.
+ = adds two operands
– = subtracts the right operand from the left operand
* = multiplies two operands
/ = divides right operand into the left operand. The result is always a floating-point number.
% = divides the right operand into the left operand and returns the remainder
6. Concatenation is when you are putting two strings together. The operators are + and +=.
7. You have to use parenthesis () to prompt a user for a response.
8. A function in Javascript is a set of statements to organize your code to make it easier to create, maintain and reuse.. All functions have a name, are passed zero or more pieces of information, and return a value.
9. Calling a function is the name the function you want to call followed by parentheses.
10. Arguments are where your function call contains some data that you pass into the function.
11. The purpose of the return keyword in functions is to stop everything it is doing, return whatever value you specified to the caller and exit the function only not the program.
Akhirah Miller says
Hi Bita,
I agree with your answer for question 8 , I had a hard time explaining this answer.
Brandon Lee says
Hi Bita! I like how you showed the rules associated with naming a variable in a list form. It makes it easy to understand and follow. I also like how you added the % and gave a great definition of what it does. Great post!
Satish Mishra says
Hello there, Bita.
Concerning question 4, I agree. Variables might be as long or as short as you like. There are no spaces permitted. You can begin with a letter, an underscore, or the $ symbol; you cannot begin with a number.
Kelli Spadt says
Bita,
I also liked your answer for number 8 it was a hard one to explain.
Kelli
Akhirah Miller says
What is a variable in JavaScript, and how do you create one?
– A variable is the name of a storage location, when creating a variable you have to give it a type, a name, and a variable.
How do you initialize a variable?
-adding (=) to the right of the variable name. You can only initialize a variable in a declaration.
What is the difference between initialized and declared?
-Declaration: Variable is registered using a given name within the corresponding scope. Initialization:
When you declare a variable it is automatically initialized, which means memory is allocated for the variable by the JavaScript engine.
What are the rules associated with naming a variable?
-variable names can consist of Upper/lowercase letters A-Z, digits 0-9 and two special characters such as underscore (_) or dollar signs ($).
What are the arithmetic operators in JavaScript, and what do they all do?
-addition (+), subtraction (-), multiplication (*), and division (/), these operators allow us to do mathematical operations on data operands.
What is concatenation, and what are the concatenation operators?
-concatenation is combining two strings together, the operators are the + or += operator, or the concat() method.
What is the line of code used to prompt a user for a response?
-the “prompt ()” method uses a dialog box which prompts the user for input.
What is a function in JavaScript, and what do all functions have?
–Javacript codes that perform a task and/or calculates vaules.. Functions must have a return statement that tells the values to return.
What does calling a function do?
-can be used call a method with an owner a argument.
What does it mean to pass a function arguments, and what does that do?
-Function can be passed to another function as an argument which allows the function being called to carry out the its actions.
What is the purpose of the return keyword in functions?
-it stops the execution of a functions and returns the control to the calling functions
Anna Bauza says
Hey Akhirah:
I liked your explanation of defined and declared, you put it into a simple context and the variable naming rule. You did a good job with the post answers. Thanks.
Ashanna Khan says
Hello Akhirah, great job on this post. You answered clearly and was able to explain concisely.
Ndeye Sall says
Hi Akhirah,
i loved how you worded your answer to number 10, i had difficulty with that question.
Brian Johnson says
Hi Akhirah, I liked the way you mentioned the arithmetic operators. They remind me of some the math courses that I have had to take.
Olivia Jardel says
Akhirah,
I liked your explanation for the last question regarding the return keyword.
Alexander Neff says
Hey Akhirah,
I really liked your explanation of defined and declared, you put it into a simple context and the variable naming rule. Great post!
Brandon Lee says
1. The variable in JavaScript is any value that can change under any condition. It is created by using the keyword var, to declare the variable.
2. To initialize a variable you add the equal sign (=) after the variable name.
3. Initialized explains if the value is assigned to the variable and declared is when there is no value assigned to it.
4. The rules associated with naming a variable is it can only have lowercase and uppercase letters, no spaces, and can start with a letter, underscore or $ sign. It can be as long or short as you want it.
5. The arithmetic operations in JavaScript is addition (+), subtraction (-), Multiplication (*), division (/), and the numerical values.
6. Concatenation is putting 2 strings together. The operators include (+) and (+=).
7. The line of code used to prompt a user for a response is “prompt()”
8. The function in JavaScript is the set of statements that organizes the code to make it easier to create, maintain and reuse. All functions must have a return statement, a name, and passing 0 or more lines of information.
9. Calling a function applies the same function to more than one object. It can be used by naming the function and following it with parentheses ().
10. Passing a function argument means a function can be passed to another function as an argument to be carried out as an action.
11. The purpose of the return keyword in a function is to end everything that it is doing and to return the value you specified.
Anna Bauza says
Hey Brandon:
Great post. I like how your explanation was simple but can be understood very clearly. Thanks.
Anna Bauza says
What is a variable in JavaScript, and how do you create one?
Variable means anything that can vary. In JavaScript, a variable stores the data value that can be changed later on
How do you initialize a variable?
The syntax for an initializer is the type, followed by the variable name, followed by an equal sign, followed by an expression.
What is the difference between initialized and declared?
Declarations specify the type followed by the name, and optionally the initialization. Initialization sets the variable to a new instance.
What are the rules associated with naming a variable?
A variable can have alphabets, digits, and underscore. A variable name can start with the alphabet, and underscore only. It’s can’t start with a digit.
What are the arithmetic operators in JavaScript, and what do they all do?
Addition (+), subtraction (-), multiplication (*), and division (/).
What is concatenation, and what are the concatenation operators?
A binary operator, whose syntax is shown in the general diagram for an SQL expression. You can use the concatenation operator (||) to concatenate two expressions that evaluate to character data types or to the numeric data types.
What is the line of code used to prompt a user for a response?
Prompt ()
What is a function in JavaScript, and what do all functions have?
A set of statements that performs a task or calculates a value, but for a procedure to qualify as a function, it should take some input and return an output where there is some obvious relationship between the input and the output.
What does calling a function do?
When you call a function, you are telling the computer to run (or execute) that set of actions.
What does it mean to pass a function arguments, and what does that do?
A function can be passed to another function as an argument.
What is the purpose of the return keyword in functions?
Ends the execution of a function, and returns control to the calling function.
Bita Bagheeri says
Hi Anna,
I agree with your explanation on what a variable is. The root word var usually means change or alter, which pretty much defines the word “variable”.
Ross Faber says
Great job with this post, Anna. Reading through this helped me further grasp some of the concepts.
Kevin Desouza says
For your number 3, Declared is when you create a variable but do not assign a value to it. Once you assign a value, it is initialized.
Satish Mishra says
• What is a variable in JavaScript, and how do you create one?
Answer- Variables in JavaScript are containers that hold reusable data. It is the basic unit of storage in a program. To create a variable, use the var keyword, followed by the name of the variable, and then a semicolon, like this:
• How do you initialize a variable?
Answer- The name of a variable is followed by an equal symbol (=). Place an expression to the right of the equal sign.
• What is the difference between initialized and declared?
Answer- Declaring variable reserves a name and some memory space for a variable of the given type, but it does not assign a value to it. Initializing assigns a value to the variable.
• What are the rules associated with naming a variable?
Answer- The rules associated with naming a variable are
a. Integers cannot be used as variables.
b. An integer cannot be used to begin a variable.
c. Variable names are limited to letters, digits, underscores, and the dollar symbol.
• What are the arithmetic operators in JavaScript, and what do they all do?
Answer- Arithmetic operators perform arithmetic on numbers (literals or variables). They are addition (+), subtraction (-), multiplication (*), and division (/). They take literal or variable numbers as operands and give back a single number.
• What is concatenation, and what are the concatenation operators?
Answer- Concatenation operators are used to combine two or more strings into one. + and & are the two operators for putting things together.
• What is the line of code used to prompt a user for a response?
Answer- To ask a user a question, you have to use parenthesis ().
• What is a function in JavaScript, and what do all functions have?
Answer- The function keyword, followed by a name, followed by parentheses, define a JavaScript function (). Function names can contain letters, digits, underscores, and dollar signs (same rules as variables).
• What does calling a function do?
Answer- When you call a function, that function is used on more than one object. It can be used by calling out the function and putting parentheses after it ().
* What does it mean to pass a function arguments, and what does that do?
Answer- Passing arguments in functions involves passing a value to the function that specifies the operation to be done. In functions, arguments can be sent in one of three ways. Pass by Value / Call by Value.
* What is the purpose of the return keyword in functions?
Answer- The return keyword is used to return the values of the input to another function. It is mostly used for return values and can be replaced with any statement. A return statement only returns string, float, and integer values.
Ted Stoler says
Hi Satisha,
Great post. In addition to what you mentioned about the rules associated with variables, one thing to add is that the first character cannot be a digit. Great post!
Ashanna Khan says
Hi Satish, great work on this post. To add, the line of code to prompt a user for a response should include prompt.
Ndeye Sall says
Hey Satish,
you did a great job of articulating your responses yet still keeping them well understood.
Alexander Neff says
Hey Satish,
I really like how you explained what a return statement does in functions. They are very diverse. Great post!
Adelina Chornodola says
Hi Satish,
this was a great post. You explained everything so thoroughly that would help someone learn more about javascript if they knew nothing about it How like how you listed the rules of naming a variable.
Jieun Han says
The return keyword in function is very useful!
We can comeback where we left off and do not have to end the program!
Ashanna Khan says
1. A variable in JavaScript stores the data value that can be changed later. To create a variable, you give it a type, a name, and a value.
2. A variable can be initialized by entering the type, followed by the variable name, followed by an equal sign, followed by an expression.
3. Declarations specify the type followed by the name, and optionally the initialization. Initialization sets the variable to a new instance
4. A variable name can consist of Capital letters A-Z, lowercase letters a-z digits 0-9, and two special characters such as _ underscore and $ dollar sign. The first character must not be a digit. Blank spaces cannot be used in variable names. Java keywords cannot be used as variable names.
5. + adds two numbers together, – subtracts the right number from the left, * multiplies two numbers together, / divides the left number by the right, % divides the right number into the left and returns the remainder.
6. Concatenation means to combine the variable to another string.
+ concatenates two values, += adds the result of the expression to the end of the variable.
7. The line of code used to prompt a user for a response is “prompt()”
8. A function in JavaScript is a way to organize your code to make it easier to create, maintain and reuse. All functions have a name, are passed zero or more pieces of information, and return a value.
9. Calling a function is telling the computer to run (or execute) that set of actions.
10. This means a function can be passed to another function as an argument. This allows the function being called to use the function argument to carry out its action.
11. A return statement ends the execution of a function and returns control to the calling function.
Ted Stoler says
Hi Ashanna,
I did like your explanation in regards to the arithmetic operators. Not only did you identify what the operators where but also elaborated with how the equations are solved.
Adelina Chornodola says
Hi Ashanna, great job at explaining the arithmetic operations. Also I loved how you describe a function, helped me understand it more.
Suela Haxhiu says
Hi Ashanna!
Your explanations are clear and concise and very easy to follow, which is very helpful because coding can get complicated, fast!
Ted Stoler says
1.) A variable stores a value that can be changed later on using the keyword var to declare a variable.
2.) To initialize a variable you need to use the type, followed by the variable name, followed by an equal sign followed by an expression.
2B.) Declarations specify the type followed by name, initialization sets the variable to a new instance.
3.) A variable can consist of capital letters, lower case letters, numbers, and two special characters under score or dollar sign, the first character cannot be a number.
4.) The four arithmetic operators are addition (+), subtraction (-), multiplication (*) and division (/). Their purposes are to take numerical values as operands and return a single numerical value.
5.) The two concatenation operaters are + and &. Their purpose is to join multiple strings into a single string.
6.) To get a prompt you would use prompt() this would prompt the user for input.
7.) The function must have a return statement that specifies the value of return. A functions is a set of statements that performs tasks or calculates a value.
8.) Calling a functions allows for a function that belongs to an object to be assigned to a different object.
9.) Passing a function argument allows the function to be called to use the function argument to carry out its action. The argument is essentially a way to pass more information into a functions.
10.) A return statement ends the execution of a function and returns control to the calling function.
Brian Johnson says
Hi Ted, I think it’s interesting how function arguments can actually be a means for getting more information then you would normally expect. In a lot cases these arguments can help more.
Ross Faber says
Hey Ted – great call out specifying that function names cannot begin with a numerical value. Very important to naming functions.
Zachary Whitehair says
Hey Ted,
Good work on your post, I liked the way you answered question 9, it helped me to understand the concept better.
Molly Lehr says
Hey Ted,
Nice work on your post. Good job pointing out that variables cannot start with a number. It’s a very important thing to remember.
Ndeye Sall says
What is a variable in JavaScript, and how do you create one?
A variable in JavaScript stores a value that can be changed later. You create one on the var keyboard and declare one.
How do you initialize a variable?
You initialize a variable by entering the type, name, equal sign, and expression.
What is the difference between initialized and declared?
Initialized is assigning a value to the variable while declared is when a value isnt assigned to a variable.
What are the rules associated with naming a variable?
A variable can only have letters, digits, and some type of symbol.
What are the arithmetic operators in JavaScript, and what do they all do?
The arithmetic operators are addition, subtraction, multiplication, and division. Their purpose is to take numerical values and return a single number.
What is concatenation, and what are the concatenation operators?
Concatenation is the ampersand &; they use to concentrate strings.
What is the line of code used to prompt a user for a response?
The line of code is prompt().
What is a function in JavaScript, and what do all functions have?
A function is composed of a sequence of statements called the function body. All functions have a name and return value.
What does calling a function do?
Calling a function tells your computer to run the actions.
What does it mean to pass function arguments, and what does that do?
A function can be passed to another function as an argument. This allows the function being called to use the function argument to carry out its action
What is the purpose of the return keyword in functions?
The purpose is to end execution.
Brian Johnson says
A variable in java script can be anything depending on the situation. A variable can be created by using the reserved keyboard var.
To Initialize a variable, you have to add an equal sign (=) to the right of the variable name,
and write an expression to the right side.
The difference between an initial and declaration is that if the value is not assigned to the variable, then then the process is only a declaration.
The rules is that a variable can only have letters, digits, and an underscore.
Arithmetic operators are addition, subtraction, multiplication, and division. They take numerical values as their operands and return a single numerical value.
A concatenation is a series of interconnected things or events. Concatenation operators join multiple strings into a single string The two operators are + and &.
The line of code used for response is parenthesis ()
A function in javascript is composed of a sequence of statements called the function body. All functions return a value and are seen as first-class objects because they have properties just like many other objects.
Calling a function means you are telling the computer to run or execute a specific set of actions in which a definition can be provided anywhere within your code.
To pass a function arguments means to pass other information, specifically with a most likely opposing view. The function being called can use the function argument to carry out it’s action.
The purpose for a return keyboard is that it ends the execution of a function and control shifts back to the calling function.
Olivia Jardel says
-A variable is an identifier for a value. You create a variable by assigning a specific phrase to a variable, and instead use that variable every time you want to use that phrase.
-Declaring a variable means assigning a specific phrase to a word you want to use in a code. Initializing a variable means assigning a value to a the variable chosen. You initialize a variable by using = in the line of code with your chosen phrase.
-A variable can be named anything you want, as short or as long as you want. It cannot start with a number and not include any spaces. It can start with a letter, underscore, or the $ character. You are also able to combine upper and lower case letters.
-The addition operator (+) adds two operands. The subtraction operator (-) subtracts the right operand from the left operand. The multiplication operator (*) multiplies the two operands. The division operator (/) divides the right operand into the left operand. The result is always a floating point number (number that includes a decimal point). The modulus operator (%) divides the right operand into the left operand and returns a remainder.
-Concatenation is putting two strings together. The (+) concatenation operator adds two strings together. The (+-) concatenation operator adds the result of the expression to the end of the variable.
-The line of code that prompts the user for a response is “=prompt(“.
-A function in JavaScript is a way to organize your code, which makes it easier to create, maintain, and reuse. All functions have a name, return a value, and are passed zero or more pieces of information.
-Calling a function invokes the function and makes it work within the code. Without calling the function, it does not do anything.
-Passing function arguments means that the information in the function call, gets passed through into the function, which then can return data based on how the user wants the function to perform.
-The return keyword in function is used to send data back to the part of your code that initially called your function in the first place.
David Trickett says
Hey Olivia,
I liked how you described what a floating point number was, which is a term I have personally never heard or seen anywhere before learning it in this course, as I’m sure is the case with many others. You provided strong insight into the topics in a neat and succinct manner.
Great job!
Molly Lehr says
Hey Olivia,
Great post! I liked your answer for the passing functions argument. You made it easier to understand the concept.
Kelli Spadt says
-What is a variable in JavaScript, and how do you create one?
In JavaScript a variable stores the data value that can be changed later on you create one by using the left keyword example =’Hello!;// define the variable and assign the value alert (message); Hello!
-How do you initialize a variable?
Use the assignment operation = to set the variable name equal to a piece of data
-What is the difference between initialized and declared?
Initialization is the process of assigning a value to the variable if the value is not assigned to the
variable, then the process is only called a declaration
-What are the rules associated with naming a variable?
a variable name must start with a letter or an ( _ ) cannot start with a digit can only contain alphanumeric characters and underscores
-What are the arithmetic operators in JavaScript, and what do they all do?
They are operators that allow us to apply mathematical operations on numerical data operations they perform addition subtraction multiplication division etc.
-What is concatenation, and what are the concatenation operators?
Concatenation is a technique used in programming to merge two or more strings into one value an operator concatenates two or more string values together and returns another string which is the union of the two strings
-What is the line of code used to prompt a user for a response?
The ( ) signs
-What is a function in JavaScript, and what do all functions have?
It is a set of statements that performs a task or calculates a value and they all have these symbols { }
-What does calling a function do?
It recalls the steps that were previously defined and executes them
-What does it mean to pass a function argument, and what does that do?
this means a function can be passed to another function as an argument. This allows the function being called to use the function argument to carry out its action.
-What is the purpose of the return keyword in functions?
Its purpose is to return a value from a method. It is also used to finish the execution of a method.
Mia Quagliariello says
Hi Kelli!
I really like how you explained passing a function argument, as I had some difficulty with describing the concept! I really like how Javascript makes it easy to keep organized and ‘clean’ code especially with defining and reusing functions.
Ross Faber says
Q: What is a variable in JavaScript, and how do you create one?
A: A variable in JavaScript is a bit of stored information (a value). It is stored in a named bucket.
Q: How do you initialize a variable?
A: A variable is initialized by adding an operator and then defining the text or object you want presented.
Q: What is the difference between initialized and declared?
A: Declaring a variable simply alerts that a line of code needs to do something. Initializing it properly adds desired “content” that should be displayed. Without a variable being initialized, the declaration is meaningless.
Q: What are the rules associated with naming a variable?
A: Variables can be any length – short or long. They cannot start with a number.
Q: Beyond the first character, there is no rule about what characters can be used.
A: They do not allow spaces.
Q: What are the arithmetic operators in JavaScript, and what do they all do?
A: The arithmetic operators are addition, subtraction, multiplication, division, and percentage. The operators allow for simple math to be performed in JavaScript.
Q: What is concatenation, and what are the concatenation operators?
A: Concatenation is the combining of strings. + or += are the concatenation operators.
Q: What is the line of code used to prompt a user for a response?
A: Prompt() is used to prompt responses.
Q: What is a function in JavaScript, and what do all functions have?
A: A function groups statements together and allows the code to be reusable. All functions have a name, a return statement, and pass zero or more lines of information.
Q: What does calling a function do?
A: Calling a function allows the function to do what it is supposed to do. Without calling the function, the function does not do anything.
Q: What does it mean to pass a function arguments, and what does that do?
A: Arguments pass data into a function to return specific values/data.
Q: What is the purpose of the return keyword in functions?
A: The return keyword retrieves data from a function.
Anthony Rosado says
Hi Ross, it’s interesting that variables can be any amount of characters, including thousands.
Alexander Neff says
A variable is a label that references a value. We create one by writing var and then an alphanumeric character. In order to initialize a variable, you must put var, the variable name, an equal sign, then the expression. Declaring a variable tells the system about the existence of the variable. Initializing is the process of assigning value to the variable.
When naming a variable, it cannot start with a digit. It can have any combination of alphanumeric values as well as special characters. Arithmetic operators in JavaScript perfom simple tasks like addition, subtraction, multiplication, and division.
Concatenation strings together code. For example, when coding to find the perimeter of a rectangle, the code would be strung together to include the variables of the length and width, and then to find the perimeter is 2 lengths plus 2 widths. That entire string of operations Is considered concatenation. A function performs a task or calculates a code. Calling a function will take some input and return an output. To pass a function argument means that a function cannot pass another function as an argument; in other words, the function must carry out its action. The purpose of return keywords in functions is to execute the function and then return control to the calling function.
Oliver Forssell says
Hi Alex,
I like how you kept your definitions simple and explained everything in steps, definitely helped my understanding of variables.
David Trickett says
– In JavaScript, a variable is defined as both an identifier for a value and a named bucket for storing some data. To create/declare a variable, you start with the keyword “let” then declare the variable by adding a name after, such as “myText.”
– To initialize a variable, you add an equals sign with spaces surrounding it (” = “), followed by a value such as “hello, world!” like we did in class.
– The difference between initialized and declared is that initialized refers to adding a value to a variable that allows for the code to run, while declared refers to creating the variable based upon the “let” keyword and the desired name given to the variable.
– The rules associated with naming a variable include: 1) variables can be as short or as long as you desire, 2) variables can start with a letter, underscore, or the “$” character, but they cannot start with a number, 3) outside of the first character, variables can be made up of any combination of letters/underscores/numbers/$ characters, as well as with mixing upper and lowercase characters.
– The arithmetic operators in JavaScript are “+” for addition, “-” for subtraction, “*” for multiplication, “/” for division, and “%” for Modulus. Addition adds two operands, subtraction subtracts the right operand from the left operand, multiplication multiplies the two operands, division divides the right operand into the left, which always results in a floating-point number, and modulus divides the right operand into the left operand and returns the remainder.
– Concatenation, as defined in the powerpoint, is said to be a fancy name for putting two strings together. The concatenation operators are: 1) “+” which concatenates two values, and 2) “+=” which adds the result of the expression to the end of the variable.
– The line of code used to prompt a user for a response is “prompt()”
– A function in JavaScript is a reusable block of code that takes arguments, groups statements together, and can be called on to execute the code contained inside it. All functions have a name, are passed zero or more pieces of information, and return a value.
– Calling a function, aka invoking a function, tells the computer/program to run the set of actions contained in the function.
– To pass a function argument means to pass one function as an argument to another function. What this does is allow the function being called to use that argument to carry out the function’s action.
– The purpose of the return keyword in functions is to stop the running function at that keyword, return the specified value to the caller, and exit the function.
Mia Quagliariello says
Hi David!
I liked your explanation of concatenation. The concept of tying two strings in theory seems pretty simple to me, but when I was working on the solo learn, I thought they were a bit tricky at first with the various symbols.
Suela Haxhiu says
Hi David,
You provide some great insights. if i had to guess, you seem pretty confident with code/java script.
Robert Manzo says
Hey David, good job with this post. Your post was very informative and easy to follow. I learned a lot from reading this. This subject is difficult, but your insights made it much clearer for me to understand.
Adelina Chornodola says
– A Variable in javascript is a value you can change depending on the outcome you need. You create one by using the reserved keyword var to declare the variable.
– You initialize a variable by inserting the = sign after the variable name
– The difference between initialized and declared is that a declaration is when a vale is not assigned to a variable and initialization is when a value is assigned to a variable.
– When naming a variable it can only have letters, underscore and $ starting out but not a number.
– The arithmetic operation are (+,-,*,/) They take the literal or variable numbers as opreands and return single numbers
– A concatenation is combining the multiple strings together. You use + or +=.
– The line of code used to prompt a user for a response is ()
– A function in javascript is used to organize your code. All functions have a name, return value, and pass zero or more lines of information.
– Calling a function means giving it a name you want
– To pass function arguments means it can be passed to another function. This allows for data to be returned allowing it to carry out its action.
– The purpose of the return keyword is that it retrieves data from a function.
Anthony Rosado says
Hi Adelina, declared is when a variable is not assigned a value and is just a shell.
Zawahi Mustafa says
Hello Adelina,
I like reading your response to this weeks questions it was very clear and easy to understand. Thanks and great job!!
Anthony Rosado says
• What is a variable in JavaScript, and how do you create one?
o A variable is a value that changes depending on the conditions set. You create one by using the command var or let.
• How do you initialize a variable?
o You initialize a variable by adding an equal sign to the right of the variable.
• What is the difference between initialized and declared?
o Declared is when it does not contain a value. It’s an empty shell. Initializing a variable to a value like….hello, world!:
• What are the rules associated with naming a variable?
o Variables can be as short as one character, or they can be as long as you want – thousands and thousands of characters.
o values can start with the letter, underscore, or the dollar sign character period they can’t start with a number.
o Outside of the first character, variables can be made-up of any combination of letters, underscores, numbers, and $ characters. You can also mix and match lowercase and uppercase.
o Spaces are not allowed.
• What are the arithmetic operators in JavaScript, and what do they all do?
o +, addition, add two operands,
o -, subtracts the right operand from the left operand
o *, multiplies 2 operands
o /, divides the right operand into the left operand. The result is always a floating-point number.
o %, modulus, divides the right operand into the left operand and returns the remainder.
• What is concatenation, and what are the concatenation operators?
o Concatenation put two strings together.
o +, concatenates two values
o +=, adds the result of the expression to the end of the variable
• What is the line of code used to prompt a user for a response?
o Prompt()
• What is a function in JavaScript, and what do all functions have?
o A way to organize your code to make it easier to create, maintain and reuse.
o all functions have a name our passed zero or more pieces of information, usually return a value.
• What does calling a function do?
o It evokes a function.
• What does it mean to pass a function arguments, and what does that do?
o The function call contains some data that you pass into the function.
• What is the purpose of the return keyword in functions?
o the return keyword allows you to send data back to whatever called your function in the first place.
Zawahi Mustafa says
Hello Anthony,
You seem to understand JavaScript because your responses were straightforward and easy to understand. Thanks, Great Job!!
David Trickett says
Hey Anthony,
You made a good point about using either the keyword “var” or “let,” as both are recognized in JavaScript, yet “let” is more often used in recent times. You also did a great job in organizing and explaining your responses in detail.
Well done!
Jessica Mejia says
HI Anthony, I like your responses they are straightforward.
Robert Manzo says
Hey, Anthony good job with this post. All your answers were to the point and detailed. I agree that understanding variables is extremely important to know regarding JavaScript.
Zawahi Mustafa says
A variable is an identifier for a value. The way to create a variable by using the command var or let. The way you initialize a variable is you add an equal sign to the right of the variable.. Declared means the variable has no value it is an empty shell. Initialize a variable is adding a value to the variable. The rules for naming variables:
1.They cannot start with a number
2. They can be short or as long as you want
3. variables can start with a letter, underscore, or the $ sign.
4. outside the first character they can have many different combinations of letters, symbols and $ characters.
5. spaces are not allowed.
The arithmetic operations in JavaScript and there functions:
1. addition, add two operands,
2. subtracts the right operand from the left operand
3. multiplies 2 operands
4. divides the right operand into the left operand. The result is always a floating-point number.
5. %, modulus, divides the right operand into the left operand and returns the remainder.
concatenation is combining the multiple strings together. You use + or += .
The line of code used to prompt a user response is ().
A function basically:
1. Groups statements together
2. Makes your code reusable.
Calling a function means invoking a function it tells the computer or program to run the set of actions contained in the function.
The meaning of a function call is it contains some data that you pass into the function.
The purpose of the the return keyword is it allows you to send data back to whatever called your function in the first place.
Cassadi Gallagher says
Hello Zawahi,
I like that you listed the rules of naming variables. It made it much easier to follow and understand. Also, completely forgot to mention that spaces aren’t allowed in the naming of variables.
Stefanie Meier says
Hi Zawahi-
Great responses, I forgot to add to mine to not put spaces! I hope you continue to understand JavaScript like you seem to be right now!
Oceana Gilkerson-Heinaman says
I like that you included “let” along with “var” for your first response, and how your answers all flowed together!
Mishelle Werner says
Hi Zawahi,
I love your explanation of variables and you did a great job of outlining the rules.
Kevin Desouza says
1. What is a variable in JavaScript, and how do you create one?
– In Javascript, a variable stores the data value that can be changed. You can create one by using the keyword var to declare the variable.
2. How do you initialize a variable?
– adding an equal sign after the variable.
3. What is the difference between initialized and declared?
-Declared is when you create a variable but do not assign a value to it. Once you assign a value, it is initialized.
4. What are the rules associated with naming a variable?
– Variables must be at least a character long but they can not start with a number. Lastly, variables can not have spaces.
5. What are the arithmetic operators in JavaScript, and what do they all do?
–
+ addition, which adds operands. – subtraction, which subtracts the right operand from the left operand. * Multiplication, which multiplies two operands.
/ division, which divides the right operand into the left operand. finally, % modulus, which divides the right operand into the left operand.
6. What is concatenation, and what are the concatenation operators?
-concatenation joins multiple strings into a single string. + and +=
7. What is the line of code used to prompt a user for a response?
– Prompt()
8. What is a function in JavaScript, and what do all functions have?
– A function is a means to organize your code to make it easier to create, maintain, and reuse.
All functions have a name, are passed zero or more pieces of information, and usually return a value.
9. What does calling a function do?
– when are telling the program to execute that set of functions.
10. What does it mean to pass a function arguments, and what does that do?
-A function can be passed to another function as an argument.
This allows the function being called to use the function argument to carry out its action.
11. What is the purpose of the return keyword in functions?
– Allows you to send data back to whatever called your function in the first place
Jessica Mejia says
HI Kevin, your responses are straight forward when understanding coding.
Anthony Isaac says
Kevin,
Great job on your answers. I liked how you answered question five and identified all the operators.
Stefanie Meier says
Hey Kevin-
Thanks for numbering your responses! This made it really easy to follow along! Great job!
Robert Manzo says
Hey, Anthony good job with this post. All your answers were to the point and detailed. I agree that understanding variables is extremely important to know regarding JavaScript.
Jessica Mejia says
• A variable in JavaScript is an identifier for a value. It’s created by using the keyword var.
• Too initialize a variable, you add the value by using (=) to follow.
• The difference between initialized and declared is that if it’s declared it doesn’t contain anything of value, to add value you initialize it.
• The rules associated with naming variables is that spaces aren’t allowed, the variables can be a combination of letters, underscores, numbers, characters, lower and uppercase. They can’t start with a number. The variables can be short as one character or super longer.
• The arithmetic operation in JavaScript is addition (+), subtraction (-), multiplication (*), and division (/). They take the numerical values as their operands and return single numerical value.
• Concatenation is joining test strings together in a program to make a new text string. The operators are (+), and (&).
• The line of code used to prompt user for a response is “()”.
• A function in JavaScript is a wrapper for some code which just groups statements together and is going to make your code reusable. All functions have inputs and outputs and return an output where there is a relationship between the inputs and the outputs.
• Calling a function is the name of the function we want to invoke following by a parenthesis.
• To pass a function argument means the function can be passed around like other values. It allows the function being called to use the function argument to carry out the action.
• The purpose of the return keyboard in function is that a default value of undefined is returned.
Cassadi Gallagher says
Hi Jessica,
I like how your explanations are simple and easy to understand, especially when you explained that a function is a wrapper for code to make it reusable. I also thought that the way you explained concatenation was simple and helped me understand.
Mishelle Werner says
Hi Jessica,
Great explanations about variables and function. I specifically liked your explanation of the difference between a declaration and initialization.
Cassadi Gallagher says
* What is a variable in JavaScript, and how do you create one?
A variable is something that can change. It is a way to label or store information, or a value. To crest a variable, you use vat to tell DSC it’s a variable, or let. You have to give it a name, type, such as Boolean, and value.
* How do you initialize a variable?
To initialize a variable you add an equal sign at the end. Then write an expression.
* What is the difference between initialized and declared?
The difference between initialized and declared is initialize does have a value assigned and declared does not.
* What are the rules associated with naming a variable?
Variables can be as long or short as you want. They can start with any letter, an underscore, or a $. They cannot start with a number. After the first letter/sign, you can use any combination of numbers, letters, underscores, and $ signs.
* What are the arithmetic operators in JavaScript, and what do they all do?
+ adds two numbers together, – subtracts right number from left, * multiples two numbers together, / divides left number from right, % returns remainder left over, ++ adds 1 number to value, – – subtracts one number from value
* What is concatenation, and what are the concatenation operators?
Concatenation brings two strings together, which are data types that can include any characters and is used to represent text. The concatenation operators are + and &. + adds two numbers of puts two strings together. & is only used for strings and brings two strings together.
* What is the line of code used to prompt a user for a response?
“prompt ()”
* What is a function in JavaScript, and what do all functions have?
A function is a block of code to perform task or calculate value. All functions have a name, keyword, input, and output.
* What does calling a function do?
Calling a function makes the computer execute the code or telling the computer to do what the function describes, after you’ve defined it.
* What does it mean to pass a function arguments, and what does that do?
Passing a function as an argument allows one function, for example square, to use another function, for example sum, to carry out its action as an argument.
* What is the purpose of the return keyword in functions?
The return keyword stops the execution of any code and returns the value you specify.
Anthony Isaac says
Cassadi,
I liked how you answered your question. They are clear and very informative.
Joanna Flores says
Hi Cassadi, your answers are very straight forward and show that you are knowledgeable about Javascript!
Zachary Whitehair says
Hey Cassadi,
I liked the way you answered your questions, you made sure to be thorough. Good work
Oceana Gilkerson-Heinaman says
Your explanation of concatenation is very thorough- I like that you included that it is only used for bringing strings together. The name makes it seem like it might be more complex but your explanation made a lot of sense!
Mia Quagliariello says
What is a variable in JavaScript, and how do you create one?
– In JavaScript, a variable contains a value and to create a variable you use let and give it a name.
How do you initialize a variable?
– To initialize a variable, you can assign the variable with a value using the = sign operator.
What is the difference between initialized and declared?
– Declaring simply variable states the variable, while initialized fixes the variable to a value.
What are the rules associated with naming a variable?
– A variable cannot start with a number and cannot have any spaces in it. After the first letter, numbers can be used and names cannot contain special symbols such as #.
What are the arithmetic operators in JavaScript, and what do they all do?
– Using + to add, subtract with -, multiply with * and divide using / to do basic arithmetic functions. Modulus can display remainders using %.
What is concatenation, and what are the concatenation operators?
– It puts 2 strings together using + and +=.
What is the line of code used to prompt a user for a response?
– prompt() can let a user input a response.
What is a function in JavaScript, and what do all functions have?
– A function is a reusable block of code used to perform a task. All functions have a name to ‘call it’ and that can be reused to recall the task again and again.
What does calling a function do?
– Calling a function executes the function as is defined.
What does it mean to pass a function argument, and what does that do?
– To pass a function argument you can define parameters in parenthesis that the function takes. Doing so takes the parameters and further defines the function and customizes it as needed.
What is the purpose of the return keyword in functions?
– The return keyword in functions returns a value from the function such as a calculation.
Cherelle Gaillard says
Hi Mia,
I agree with all your answers and they were easy to follow.
Cherelle
Anthony Isaac says
• What is a variable in JavaScript, and how do you create one?
A variable in JavaScript means anything that can be vary. It’s also basically a name of storage location.
How do you initialize a variable?
To initiate a Variable first, add an equal sign to the right of the Variables name. Then write an expression.
• What is the difference between initialized and declared?
Initialize is when the value is assign to the Variable. Declared is when the value is not assigned to the Variable.
• What are the rules associated with naming a variable?
When naming a variable the first letter should be a letter or a underscore. Also a variable name can only have letters, digits and underscores.
• What are the arithmetic operators in JavaScript, and what do they all do?
The arithmetic operators are addition, subtraction, multiplication, and division. The arithmetic operators take numerical values as their operands and return a single numerical value.
• What is concatenation, and what are the concatenation operators?
Concatenation is when one combines two strings. The concatenation operators are a plus sign (+) and plus and equals (+ =).
• What is the line of code used to prompt a user for a response?
Use parentheses ().
• What is a function in JavaScript, and what do all functions have?
A function is a set of statements that can perform tasks and calculate values. All functions have a return value and a name.
• What does calling a function do?
Calling function basically tells the computer to run that set of actions.
• What does it mean to pass a function arguments, and what does that do?
Since functions are data they can be passed around like other values. This means that they can be passed to another function as an argument.
• What is the purpose of the return keyword in functions?
The purpose is that it ends the execution of a function and then returns a value.
Joanna Flores says
Hi Anthony, your answers show that you are doing well with understanding how javascript works. I liked how it was easy to read you questions followed by your answers!
Joanna Flores says
What is a variable in JavaScript, and how do you create one?
A variable is a value that changes or can vary depending on the conditions one sets to it,. You create one by using the command var or let.
How do you initialize a variable?
In order to initialize a variable one adds an equal sign to the right of the Variables name. Then write the expression.
What is the difference between initialized and declared?
The difference is that a value is assigned to a variable in initialized but not with declares.
What are the rules associated with naming a variable?
There are a couple rules, some being that it must begin with a letter or an underscore, and it can include a numbers, underscores or letters.
What are the arithmetic operators in JavaScript, and what do they all do?
The arithmetic functions are addition, which adds operands., subtraction, which subtracts the right operand from the left operand., Multiplication, which multiplies two operands, division, which divides the right operand into the left operand., and also, modulus, which divides the right operand into the left operand.
What is concatenation, and what are the concatenation operators?
Concatenation is when two strings are joined together, and the two concatenation operators are + and +=
What is the line of code used to prompt a user for a response?
the line of code is prompt(), which then displays box for user to respond
What is a function in JavaScript, and what do all functions have?
A function in JavaScript is used to organize a code to make it easier to create, maintain and/or reuse. All functions have a name, and return a value
What does calling a function do?
it tells the computer to compute the function you are specifically requesting
What does it mean to pass a function arguments, and what does that do?
When passing a function argument it means that a function can be passed to another function as the argument and this allows the function being called to use the function argument to carry out its specific action.
What is the purpose of the return keyword in functions?
the purpose is to end the execution of a function and return the control to the calling functions
Christopher Elko says
Very nice formatting on your responses and well defined explanations. Strong chance I’m wrong as this isn’t my best course, but I think when it comes to ‘calling a funciton’ the computer executes a set of actions, I think (and could be wrong) that the terminology here for compute is technically different?
Zachary Whitehair says
-A variable stores the data value that can be changed later on. Use the keyword var to declare a variable.
– You can initialize a variable by putting an equal sign after the variable name. Declaring a variable is the process of defining a variable while initializing is about assigning the variable a value.
-The parameters for naming a variable include it only being made up of numbers, letters and underscores. Spaces cannot be used. The variable name cannot begin with a number.
– The arithmetic operations in JavaScript include addition (+), subtraction (-), multiplication (*), and division (/). They take numerical values and return a singular value.
-Concatenation joins multiple strings into one string. The two operators are + and &.
-prompt() is the code to prompt a user
– A function in JavaScript is a set of statements that performs a task or calculates a value. Functions need to take an input and return an output where there is a relationship between the two.
– Calling is telling a computer to run a particular function
– Pass a function argument is taking one function and passing the output to another function as an argument to carry out an argument.
– The return function ends the execution of a function and returns control to the calling function
Stefanie Meier says
What is a variable in JavaScript, and how do you create one?
A variable in JavaScript stores the data, and to create one you type “var”
How do you initialize a variable?
Use the “=’ symbol .
What is the difference between initialized and declared?
Initializing is assigning an initial value to a variable while declared Is when you create a variable without a value assigned.
What are the rules associated with naming a variable?
Start with a letter, dollar sign, or underscore.
What are the arithmetic operators in JavaScript, and what do they all do?
+ addition
– subtraction
* multiplication
/ division
What is concatenation, and what are the concatenation operators?
Joining multiple strings together; a plus sig or a plus and equals sign.
What is the line of code used to prompt a user for a response?
window. prompt()
What is a function in JavaScript, and what do all functions have?
A function is composed of a sequence of statements called the function body. All functions have a set of statements that performs a task or calculates a value,
What does calling a function do?
An object can use a method belonging to another object.
What does it mean to pass a function arguments, and what does that do?
Functions are data, and therefore can be passed around just like other values. It copies the values of the variables into the function arguments.
What is the purpose of the return keyword in functions?
the Return keyword ends the execution of a function, and returns control to the calling function.
Raj Rawal says
A variable in JavaScript is a value that can change depending on assigned conditions. The keyword var is how you can create a variable.
A variable is initialized with the equal (=) sign after the name of the variable.
A variable which is initialized when the value is assigned. A declaration is when there are no values assigned to the variable.
Naming a variable can consist of upper/lowercase letters, digits and special characters like an underscore or a dollar sign.
Multiplication (*), division (/), addition (+), and subtraction (-) are the arithmetic operators which allow for mathematical operations.
Concatenation is when two strings are put together with the (+) or (+=) operators.
“Prompt()” is the line of code used for a response from the user.
Functions in JavaScript are a set of statements which organize the code to make it easier to create, maintain and use. All functions have an input and an output.
Calling a function is equivalent to executing the function the assigned set of actions.
To pass a functions arguments is to pass it to another function as an argument. Doing this allows the function being called to use the function argument to carry out the assigned action.
The return statement ends the execution of a said function and returns the controls to the calling function.
Adam Elguindi says
What is a variable in JavaScript, and how do you create one?
The variable in JavaScript that is used to calculate the premium can change in any condition. It can be declared using the keyword var.
How do you initialize a variable?
The type of a variable can be entered, followed by its name, followed by an expression, and an equal sign.
What is the difference between initialized and declared?
Although declaring a variable provides a name and some memory space, it does not assign a value to it.
What are the rules associated with naming a variable?
A variable can only have letters, digits, and some type of symbol.
What are the arithmetic operators in JavaScript, and what do they all do?
The four arithmetic operators are addition (+), subtraction (-), multiplication (*) and division (/). Their purpose is to take the numerical values as their operands and return a single value.
What is concatenation, and what are the concatenation operators?
The concept of a concatenation refers to a series of interconnected events or things. When two operators join strings into a single string, they are called + and &.
What is the line of code used to prompt a user for a response?
the line of code used for response is parenthesis ()
What is a function in JavaScript, and what do all functions have?
The function body is a sequence of statements that are used in Javascript. All functions are first-class objects because they return a value.
What does calling a function do?
A function is a type of command that tells the computer to perform a specific action. It can be used to provide a list of actions that can be executed in a given context.
What does it mean to pass a function arguments, and what does that do?
The function argument is used to pass other information to a function that is being called. It can then be used to carry out the action of the function.
What is the purpose of the return keyword in functions?
A return keyboard is used to end a function’s execution and return the control to the calling function.
Alexandra Hyduke says
Hi Adam,
I think the return keyboard can be very valuable if you notice a mistake or change you would like to make.
Cherelle Gaillard says
1)A variable in JavaScript is any value that can change under any conditions. You can create one by using the keyword var to declare the variable.
2)You initialize a variable by adding the name of the variable followed by an equal (=) sign.
3)Initializing assigns a value to a variable. Declared is the type followed by the name.
4)A variable can only contain letters, numbers, and certain symbols.
5) Addition- adds two operands
Subtraction – subtracts the right operand from the left operand
Multiplication – multiples two operands
Division- divides the right operand into the left operand.
Modulus – divides the right operand into the left operand and returns the remainder
6) Concatenation is adding two strings together. The two concatenation operators are “+” and “+=”.
7)The line of code used to prompt a user for a response is Prompt()
8) A function in JavaScript is a way to organize your code to make it easier to create, maintain and reuse. All functions have a name, are passed zero or more pieces of information, and return a value (usually).
9)Calling a function tells the computer to run that set of actions.
10) A function can be passed to another function as an argument. It allows the other function to use the function argument to carry out its action.
11) The purpose of the return keyword allows you to send data back to whatever called your function in the first place
Alexandra Hyduke says
Hi Cherelle,
I really liked the amount of detail you gave for question 7. I think it answers the question really well.
Molly Lehr says
1. A variable in JavaScript is a name for a value. You create one by using the var keyword followed by the name you want to give your variable.
2. A declared variable doesn’t contain anything of value. An initialized variable happens when it’s assigned with a value, like “hello, world!”
3. While naming variables, a few things to know are that they can be as long as you want, your variables cannot start with a number, and spaces are not allowed.
4. The arithmetic operators in Javascript are addition, subtraction, multiplication, division, modulus, increment, and decrement. They perform arithmetic functions on numbers, both literals and variables.
5. Concatenation is putting two string variables together. The concatenation operators are +, which concatenates two values and +=, which adds the result of the expression to the end of the variable.
6. Prompt() is the line of code used to prompt a user for a response.
7. A function in JavaScript is a way to organize your code to make it easier to create, maintain, and reuse. All functions have a name, are passed zero or more pieces of information, and return a value.
8. Calling a function tells the computer to do what the function describes.
9. Passing a function argument means that a function can be passed to another function as an argument.
10. The return keyword in functions allows you to send data back to whatever called your function in the first place.
Christopher Elko says
Great job on your reply, The little reference to our lesson of Hello,world! was a nice touch.
And your definition of #7 I feel definitely explains their function better than my own post.
Suela Haxhiu says
• A variable is a label that references a value like a number or string. Before using a variable, you need to declare it. To create a variable in JavaScript, use the let keyword.
• To declare a variable, you use the var keyword followed by the variable name. Initialization occurs when you assign an initial value to a variable. The difference is one is assigning a name vs one is assigning a value.
• Variable name must begin with a letter, dollar sign ($) or an underscore (_):
• Computers follow the instruction strictly and consider values as defined without assumptions. Conventionally, variable names have been structured to start with a letter, dollar sign or underscore.
• + (add) – (subtract) / (divide) * (multiply) % (remainder/modulo) ** (exponent)
• Concatenation is the operation of joining two strings together. The term “concatenation” literally means to merge two things together.
• The ampersand (&) symbol is the recommended concatenation operator. It is used to bind a number of string variables together, creating one string from two or more individual strings. The + Operator has the primary purpose of adding two numbers. However, it can also concatenate numeric operands with string operands.
• “Prompt ()”
• Functions are a block of JavaScript code that performs a task or calculates a value. A function has a name, and it usually takes in some input and returns an output. Functions are reusable and can be executed as many times as necessary.
• This is done when we need to run the code.
• Information can be passed into functions as arguments. Arguments are specified after the function name, inside the parentheses. You can add as many arguments as you want, just separate them with a comma.
• A return is a value that a function returns to the calling script or function when it completes its task. A return value can be any one of the four variable types: handle, integer, object, or string
Oceana Gilkerson-Heinaman says
What is a variable in JavaScript, and how do you create one?
–A variable is the name for a value that can help with the re-use of a phrase when it needs to be entered again.
How do you initialize a variable?
–A variable is initialized when it is assigned to a value and given meaning. You enter the variable name, = sign, expression.
What is the difference between initialized and declared?
–A variable that has been declared uses “var” and then the name. It is initialized when it is given a value by following the above steps.
What are the rules associated with naming a variable?
–Rules include the length of the variable- it can be as short or long as needed. A variable has to start with a letter, underscore, or dollar sign character. Any character after the first can be made up of any symbols or cases. Spaces are not permitted in variables.
What are the arithmetic operators in JavaScript, and what do they all do?
–Arithmetic operators include addition (adding two operands), subtraction (subtracting right operand from left operand), multiplication (multiply two operands), division (divide right operand into left operand to get a floating-point number), and modulus (divide right operand into left operand and return remainder).
What is concatenation, and what are the concatenation operators?
–Concatenation is when two strings are put together. The operators are “+”, which concatenates two values, and “+=”, which adds the result of the expression to the end of the variable.
What is the line of code used to prompt a user for a response?
–Prompt () asks the user for a response.
What is a function in JavaScript, and what do all functions have?
–A function is a method used to make code easier to create, maintain, and reuse. All functions have a name, are past zero or more pieces of information, and usually return a value.
What does calling a function do?
–When calling a function, you are telling the program to run that specific action.
What does it mean to pass a function argument, and what does that do?
–Function arguments are the information that needs to be displayed when calling the alert function. This allows the function’s action to be carried out.
What is the purpose of the return keyword in functions?
–This allows data to be sent back to the original place that called the function.
Cherelle Gaillard says
Hi Oceana,
I agree with your answers and your post was easy to follow.
Cherelle
Robert Manzo says
In JavaScript a variable stores the data that can be changed later on. A variable is declared with the var keyboard. This known ad variable initialization
You can initialize a variable by adding an equal sign (=) to the right of a variable name to the right of an equal sign, write an expression
Initialization is the process of assigning a value to the Variable. Declaration is if the value is not assigned to the variable
A function is JavaScript is a certain block of code that can be reused over and over again. All functions have is that each input value leads to only one output value
A return statement ends the execution of a function, and returns control to the calling function.
concatenation is a group of things together or occurring together in aw way that produces a pa. Concatenation operators join multiple strings into a single string
Some rules associated with naming a variable are “available name must start with a letter or an underscore character. A variable name cannot start with a digit. A variable name can only contain alpha-numeric characters and underscores ( a-z, A-Z , 0-9 , and _ ) Variable names are case-sensitive”(W3schools)
The line of code used to prompt a user for a response is prompt()
Calling a function is when you tell your computer to run (or execute) that set of actions.
In JavaScript, arithmetic operators take numerical values either literal as their operands and return a single numerical value. Addition (+) subtraction (-) multiplication (*) division (/)
In a function argument it allows the function being called to use the function argument to carry out its actions
Oliver Forssell says
The variable in java script is what stores the data value so that it can be changed later on. You can use variables by using the “let” keyword followed by the name you want to give your variable. Variables that don’t contain a value are known as declared, to initialize a variable you have to assign a value. There are two types of initialization, variables are explicitly initialized if they are assigned a value in the declaration statement. Implicit initialization occurs when variables are assigned a value during processing. An arithmetic operator accepts numerical values as operands and returns a single numerical value. The numerical values exist as literals or variables. Concatenation is the process of combining two or more strings to form a new string by subsequently appending the next string to the end of the previous strings, which includes two types of operators, + and &. A function in JavaScript is a set of statements that performs a task or calculates a value, which all have a name, are passed zero, and return a value. Functions are also a way to organize your code. When you call a function you are telling the computer to run a set of actions. A function argument is when your call contains some data that gets passed into the function. A return keyword ends the execution of a function, and returns control to the calling function.
Alexandra Hyduke says
• What is a variable in JavaScript, and how do you create one?
– A variable in JavaScript is something that can vary and or change. It is shown as Var.
• How do you initialize a variable?
– You add an equal sign and then a name.
• What is the difference between initialized and declared?
– If there is a value than it is initialized, but if it is declared than there is not a value.
• What are the rules associated with naming a variable?
– A letter or an underscore. It cannot be a number.
• What are the arithmetic operators in JavaScript, and what do they all do?
– They are subtraction “-“, addition “+”, division “ /”, and multiplication “*”, and they help to do mathematical equations.
• What is concatenation, and what are the concatenation operators?
– It is when you add two strings together, with + and +=.
• What is the line of code used to prompt a user for a response?
– Prompt()
• What is a function in JavaScript, and what do all functions have?
– A function is multiple or a set of statements that usually have some type of input or output.
• What does calling a function do?
– It tells the computer to run the statements/function.
• What does it mean to pass a function arguments, and what does that do?
– It means to pass a function to another one, which in turn allows for those actions to be completed/ executed.
• What is the purpose of the return keyword in functions?
– The purpose, is to stop/end the execution of the function and brings you back to the previous values.
Jieun Han says
We need to aware the rules regarding naming. It is very sensitive and allows not even a typo.
Jieun Han says
What is a variable in JavaScript, and how do you create one?
Variable is a changable value depending on situations.
You can create one by using the keyword
How do you initialize a variable?
I can initialize a variable by putting the equal(=)sign after the variable name.
What is the difference between initialized and declared?
Initialization is referred as a value is assigned to a value.
Declaration is referred as no value is assigned to a variable.
What are the rules associated with naming a variable?
No space is permitted. The start can be a letter, underscore, or the $ character. No numbers
What are the arithmetic operators in JavaScript, and what do they all do?
They are addition (+), subtraction (-), multiplication (*), and division (/)
What is concatenation, and what are the concatenation operators?
Concatenation is referred as a putting two strings together such as +and – together.
What is the line of code used to prompt a user for a response?
Parenthesie () is used to prompt a user for a responce
What is a function in JavaScript, and what do all functions have?
A fuction is statements to compile codes to make it easier to create, maintain and reuse.
What does calling a function do?
It is the name of the function you want to call by parenthesis
What does it mean to pass a function arguments, and what does that do?
Function argument means where your function contains some data that you put into the function.
What is the purpose of the return keyword in functions?
THe purpose is to stop evererying that is happening and return to the valued you put to the caller and exit the fundtion.
Mishelle Werner says
A JavaScript variable is a reserved keyword that stores data values in your code. You create one by declaring the variable and connecting whatever the var will equal.
A variable gets initialized by connecting a value to it and thus storing the value for later use down the line in your code. To declare the value would be to say that let var money = whatever. To initialize it is to later say let var money = 1234
The basic rules of naming a variable are that they must start with either a letter, underscore, or a dollar sign $.
Arithmetic operators:
Addition +
Subtraction –
Multiplication *
Division /
Increment ++
Decrement —
Concatenation is when we merge two or more arrays to produce a new array. To do this we must connect the strings with the + operator.
Prompt () is used to prompt a user for interaction.
A function is a statement that performs a task or calculates a value. All functions must return a value of some kind whether that be specific or a default.
Calling a function, you are telling the computer to run that set of actions and return the output.
You can pass a function to another function so that the argument can be carried out as an action.
The return keyword ends a function in its execution and then returns the value.