what is wrong with my code? it says that When you click on the #check-btn element without entering a value into the #text-input element, an alert should appear with the text Please input a value.
Your function expects a string as an argument, so if you call the function without an argument what value will str have inside your function? (Try logging str to the console inside your function to see).
When you define a function with parameters, those parameters have no inherent value. You give them a value when you call the function with arguments.
EXAMPLE:
// function parameters are num1 and num2
function addTwoNumbers(num1, num2) {
return num1 + num2;
}
// call the function by supplying arguments to the function parameters
addTwoNumbers(2, 3)
// returns 5
You can call the function (as you were doing) to test it as you build your project. Or, you can test the function by linking the button and function and then entering values directly into the HTML input.
You do have to link the button anyway to complete the project, so you might as well do it now. However, you probably want to add a reference to the function there, rather than calling the function directly with a value. Inside your function you can then get the value from the input element and do what you need to with it.