Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JavaScrip Problems #7) Declare a function named square which has a variable \'x\

ID: 3715301 • Letter: J

Question

JavaScrip Problems

#7)

Declare a function named square which has a variable 'x' which is 5 then returns x multiplied by itself (squares the number). Then execute that function at the end of your code, the returned result should automatically print out in the console (being the last value run.)

Output:

#8

Declare a function named square which has one argument/parameter/input and returns that argument multiplied by itself (squares the number). Then execute that function given the number 5, the returned result should automatically print out in the console (being the last value run.)

Output:

ust console values 25

Explanation / Answer

function square () {

x=5

return x * x;

}

console.log("Last console value="+square ())

function square (x) {

return x * x;

}

console.log("Last console value="+square (5))

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote