Embarking on the coding odyssey, we delve into the intricacies of Day 0: Hello, World!, an integral part of the 10 Days of JavaScript series on HackerRank. This article not only provides a solution but also serves as a foundational guide for those venturing into the realm of JavaScript.
Day 0: Hello, World! | Problem
As an experienced developer, I want to share my perspective on the Day 0 “Hello, World!” challenge. Frankly, this is the most convoluted “Hello, World!” exercise ever, I’d expect beginners to somewhat struggle when a Hello World exercise should be just for teaching the very basic syntax.
A greeting function is provided for you in the editor below. It has one parameter, . Perform the following tasks to complete this challenge:
- Use
console.log()
to printHello, World!
on a new line in the console, which is also known as stdout or standard output. The code for this portion of the task is already provided in the editor. - Use
console.log()
to print the contents of (i.e., the argument passed to main).
Day 0: Hello, World! | HackerRank Solution
function greeting(parameterVariable) {
console.log('Hello, World!');
console.log(parameterVariable);
}
Day 0: Hello, World! | Output
// parameterVariable = "Welcome to 10 Days of JavaScript!";
Hello, World!
Welcome to 10 Days of JavaScript!
Problem Link: https://www.hackerrank.com/challenges/js10-hello-world/problem