Improve the given code below, make sure that the code will require input from the user. Problem: Write a Javascript function that would accept any number and return the square of that number.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 14PE
icon
Related questions
Question
I need the answer as soon as possible
Improve the given code below, make sure that the
code will require input from the user.
Problem: Write a Javascript function that would
accept any number and return the square of that
number.
const square (a) => {
1;
res = a * a;
var res
%D
console.log("Num1");
console.log("Square of "+a+" is: " +res);
console.log("\n");
}
square(5);
Transcribed Image Text:Improve the given code below, make sure that the code will require input from the user. Problem: Write a Javascript function that would accept any number and return the square of that number. const square (a) => { 1; res = a * a; var res %D console.log("Num1"); console.log("Square of "+a+" is: " +res); console.log("\n"); } square(5);
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning