Coding Challenge: Number Squaring

Apply what you’ve learned about simple functions and arrow functions in the coding exercises in this lesson.

Problem statement

Task 1

Let’s compute the square of the number to get more familiar with Simple functions (Named functions) and arrow functions (Without name). Complete the below program in which the square1() will use the simple function and and square2() use the arrow functions.

Input

square1(0);
square1(2);
square1(5);

square2(0);
square2(2);
square2(5);

Expected output

0
4
25

0
4
25

Coding exercise 1

Get hands-on with 1400+ tech skills courses.