1 min to read
Hackerrank 10 Days of JavaScript Day 1: Operators,Functions,Let and Const
Are you up for the 10 Days of JavaScript challenge on Hackerrank? This challenge is a collection of ten tasks that focus on JavaScript and, to some extent, HTML and CSS.
In this series, I will be sharing my solutions to the challenges. I will be sharing the solutions in JavaScript. I will also be sharing the solutions in HTML and CSS for the challenges that require it.
Day 1: Arithmetic Operators
- A length and width are sent to two different functions
getArea
must return the area of the shape dimensions sentgetPerimeter
must return the perimeter of the shape dimensions sent- Complete the functions
Test Case of Arithmetic Operators HackerRank Solution
Day 1: Functions
- A integer of value
n
is provided - 1 ≤ n ≤ 10
- Output the factorial value of n (n!, 4! = 4 x 3 x 2 x 1 = 24)
Test Case of Functions HackerRank Solution
Day 1: Let and Const
- A float value
r
is provided for the radius - 0 < r ≤ 100
- Print (console.log) the area of the circle
(π x r²)
- Print (console.log) the perimeter of the circle
(2πr)
- Do not overwrite the try and catch but make sure the code still works