Day 0: Hello, World

Day 0: Hello, World

Overview: 10 Days of JavaScript

This series focuses on learning and practicing JavaScript. Each challenge comes with a tutorial article, and you can view these articles by clicking either the Topics tab along the top or the article icon in the right-hand menu.

Objective

In this challenge, we review some basic concepts that will get you started with this series. Check out the tutorial to learn more about JavaScript’s lexical structure.

Task

A greeting function is provided for you in the editor below. It has one parameter, . Perform the following tasks to complete this challenge:

  1. Use console.log() to print Hello, 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.
  2. Use console.log() to print the contents of (i.e., the argument passed to main).
    You’ve got this!

Input Format

Data Type Parameter Description
string parameterVariable A single line of text containing one or more space-separated words.

Output Format

Print the following two lines of output:

  1. On the first line, print Hello, World! (this is provided for you in the editor).
  2. On the second line, print the contents of parameterVariable.

Sample Input 0

1
Welcome to 10 Days of JavaScript!

##Sample Output 0

1
2
Hello, World!
Welcome to 10 Days of JavaScript!

Explanation

We printed two lines of output:

  1. We printed the literal string Hello, World! using the code provided in the editor.
  2. The value of parameterVariable passed to our main function in this Sample Case was Welcome to 10 Days of JavaScript!. We then passed our variable to console.log, which printed the contents of parameterVariable.



Solution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/**
* A line of code that prints "Hello, World!" on a new line is provided in the editor.
* Write a second line of code that prints the contents of 'parameterVariable' on a new line.
*
* Parameter:
* parameterVariable - A string of text.
**/
function greeting(parameterVariable) {
// This line prints 'Hello, World!' to the console:
console.log('Hello, World!');

// Write a line of code that prints parameterVariable to stdout using console.log:
console.log(parameterVariable);
}

Buy Me A Coffee

Comments

10Days of JS 30Days of Code Algorithm Android Debug Bridge Android Debugging Basic for Web Blog Browsers Chrome으로 Android Debugging 방법 Correctness and the Loop Invariant hackerrank solution in javascript Debug Tools Development Environment in MacOS ES6 Front-End Funny String of Algorithms hackerrank solution in javascript Funny String of Algorithms hackerrank solution in typescript Generator Github Page with Hexo Github Pages HackerRank HackerRank in a String of Algorithms hackerrank solution in javascript HackerRank in a String of Algorithms hackerrank solution in typescript Hexo Hexo Icarus theme Hexo 블로그 만들기 Hexo+Github How Browsers work Insertion Sort - Part 1 hackerrank solution in javascript Insertion Sort - Part 2 hackerrank solution in javascript JS Library JavaScript Level1 Level2 Loops MacOS 개발 환경 설정하기 Mobile web Debugging Node.js Pangrams of Algorithms hackerrank solution in javascript Pangrams of Algorithms hackerrank solution in typescript Problem Solving Programmers Quicksort 1 - Partition hackerrank solution in javascript React RoadMap Running Time of Algorithms hackerrank solution in javascript Safari Debugging Safari Technology Preview Settings Sorting String Strings Strong Password of Algorithms hackerrank solution in javascript TypeScript blog iPhone Safari Debugging 방법 insertion sort 모바일 웹 디버깅 아이폰 사파리를 디버깅하는 방법 안드로이드 디버그 브리지 안드로이드 디버깅하는 방법
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×