I got stuck in step 37 where lesson i saying me to do this
“Use dot notation to set the onclick property of your button1 to the function reference of goStore. This function will be something you write later. Note that button1 is already declared, so you don’t need to use let or const.”
And i return i am giving this awnser
goStore=button1.onclick;
but still i am not able to clear this can anybody just guide me wether i am doing it right or wrong
you need to swap position of the two variables here, you assign stuff to the onclick property, so it has to be on the left of the =
Next time please use the Ask for help button
If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.
The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.
Hey @Sadi, It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
goStore is a function, so you need to add the parentheses at the end, it would look like this goStore(). and the question tells you to reference the button in the function, so it would look like this REDACTED SOLUTION
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.
The ‘goStore’ function has to be declared before it can be assigned to the ‘onclick’ event. I tried to do both at once and it did not work. Guess you just gotta stick to freeCodeCamp’s criteria.
That isn’t correct. The fact that the code you posted passes the test is a bug.
The parentheses in front of the function identifier will call the function.
Doing so would assign the return value of calling the function and not the function definition. The onclick property should be assigned the function identifier so it can call the function when the element is clicked.