Files
Randell Dawson 1494a50123 fix(guide): restructure curriculum guide articles (#36501)
* fix: restructure certifications guide articles
* fix: added 3 dashes line before prob expl
* fix: added 3 dashes line before hints
* fix: added 3 dashes line before solutions
2019-07-24 13:29:27 +05:30

823 B

title
title
Write Reusable JavaScript with Functions

Write Reusable JavaScript with Functions


Problem Explanation

Functions allow you to reuse code over and over. Our task is to make a simple reusableFunction() that prints out "Hi World" to the console (which you can reach with Ctrl + Shift + I).

You start off by using the function keyword, and then typing the function name (which follows Camel Case formatting). Then, type the (), and create the {} brackets. Like so:

function reusableFunction() {}

Now, your function is ready to be typed in. Use the console.log() to print a message in the console.


Solutions

Solution 1 (Click to Show/Hide)
function reusableFunction() {
  console.log("Hi World");
}