You know a bunch about JavaScript syntax, control flow, and functions! The best way to reinforce these skills is through practice. We’ve created a series of problems designed to use your JavaScript knowledge. We encourage you to review relevant lessons, look things up in the documentation, check out the hints and solution code if you get stuck, and, most of all, have fun!
The tasks provided are designed to be challenging. Throughout this code challenge, we’ll be running tests to check that the functions you write are working correctly. We’ll often provide some example code to test your function. We encourage you to write additional code to test your functions. To pass our tests, your function will need to work as described in the prompt. This means your function may seem to be passing when you run it, but it will still fail the test because it doesn’t run as expected in every situation we’re testing behind the scenes. Take special note of strings—strings must be identical to that requested to pass!
1.Write a function, greetWorld(). Your function should have no parameters and return the string 'Hello, World!'.
Helpful Notes:
Your function can be a function expression or a function declaration.
Notice that the prompt requires your function to return the string—it will not pass the test if the string is printed to the console rather than returned.
Your code must return 'Hello, World!' exactly. The test will not pass with the following strings: 'hello, world!', 'Hello, world!', 'Hello World!', 'Hello World', 'Hello, World.', etc.
// Write your function here:
//Write code to test your function. Even if we provide code to test your function, you should add further tests to make sure your function works correctly in all the specified situations