Problem with javascript code

Hello everyone, I am currently making a lead generator and my code doesn’t seem to be working .Once I enter text and try to save it I get an error message that says “Uncaught TypeError: Cannot read properties of undefined (reading length)” . There seems to be a problem with my code located on line 17, I can not seem to figure out what the problem is. Would be grateful for any feedback. Here is a link to my code.

Hello Mimmsa

I have tested the code through the link you have shared and it is working on my end. The only thing is that I have to reload the page in order for it to update and show what I have saved.

If you’re getting and error with undefined (reading length), check if the code is indeed getting any value, because from that error it seems like it is not.

If it is getting a value, check if the value is being erased before being used. Specially because it seems like you are emptying out some values.

Other than that, since I was not able to reproduce the error you mentioned, I can’t really help much further.

Good Luck. (try also an AI)

You are not passing render any argument in the add handler, it needs the array.

I am a little confused, which add handler? Which function needs the array?

In the click event listener, you call render without passing an argument.

  render();

You defined render to accept an array (represented by the leads parameter)`.

function render(leads) {

Thank you very much, it worked :smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.