How to add an element to an array?

maxNumbersToAdd is 7 elements, why is it outputting 12 elements and not 14? and again, this is not the solution I was expecting.

Can you tell me how you get 7 from that? Number your entries.

apparently I made a mistake, yes, 6 entries, but in a loop it cannot perform more than 12 entries, but how to do more?

So maxNumbersToAdd is 6. And the array starts with 6 elements.
Now answer the second part of post 22.

6 times,

So if you start with 6 elements, and add an element 6 times… at the end of the loop, as you have stated yourself, you end up with…

So.

Well, you’d need to change the number of times the code loops, wouldnt you?

How you do that is up to you.

Right now, the code will double the size of the initial array, because it counts the number of entries in the array, and then loops that many times and adds 1 each time it loops.

this does not give me anything, since the form of writing is unknown as always, and I planned a different result, without restrictions, and here only 12 times, this is a very difficult code scheme to understand, how to make everything work the way the beginners want, and not the way dictates this zhs code.

Well i’m not here to give you anything. I’m here to help you learn.

If you’re unwilling or unable to do that, there won’t be much I can do for you.

I would suggest, if you’re struggling this hard, that you try a more basic level Javascript course before attempting to understand this level of code.

But I studied at two different programming schools, it didn’t give me anything, like all the students with whom I studied, it makes no sense to read meaningless books, we are trying to figure it out ourselves, but no one understands why such a complex form of writing code is needed, so here very difficult to understand something.

Full JavaScript Course for Beginners (freecodecamp.org)

Here’s a free, Youtube based, 7 hour long, basics of javascript programming course from FreeCodeCamp. It includes things like Arrays, including adding and removing items from arrays. I’d suggest starting at the beginning.

1 Like

Yes, I know this site, but they don’t know how to explain clearly, newcomers are immediately blocked there, I also studied there half a year ago, people there don’t know how to explain, you won’t understand anything.

You’re blocked from Youtube?

I’m running out of ideas for you. You say you studied at 2 schools, and learned nothing. You say you did FreeCodeCamp (a resource many, many people have used and learned much of the basics from) and learned nothing.

I’m trying to be polite here, but at this point, i’m not sure its the courses that are the problem.

2 Likes

You can think anything, but I say it like it is, for example, when they came to work for me, I knew that I could teach anyone to work with machines or devices, there are no such people in programming, they can only give bases, but this is nothing at all gives in practice

there’s plenty of those people. You’re just not listening to them.

I’m sorry. At this point, we’ve come to an impasse, and I will leave you to try with the next person, where you can no doubt tell them about the guy on the forum that taught you nothing either.

Best of luck for the future.

1 Like

Ok,I’m always ready for dialogue

Thanks for sharing this helpful guide! Adding elements to an array is essential in programming, and your explanation makes it easy to understand.

When you teach people to work with machines or devices do you start with having them build a jet engine or a suspension bridge? Probably not.
When you talk of teaching people to work with machines do you mean how to operate machinery or how to design machines, because writing computer code is equivalent to designing machines and operating machines is equivalent to using a computer program.
Start simple and learn the basics. Your task here was array based, so you should have started by learning what type of data structure arrays are. Investigate their properties and their methods. Nobody really expects you to know everything about arrays but you should have a basic knowledge of them and know how to find out what you don’t know about them. The same can be said for all the basic data types.

2 Likes

To study it, you need to teach this correctly, since the car does not work, if the wheel is not enough, there is nothing else in the code, there is no sense in the basic knowledge, and also from training, of course, if you make the site, of course, this is done within a few hours, but for this you need to understand how it works and see the picture, this cannot be done in the code.

Point 1: this isa NOT a teaching service it is a forum which is a facility for developers to get together and help each other when they are stumped with a logic problem or want insight about an aspect of a particular computer language or program.
Web browser applications requires knowledge of more than one computer language and trying to learn four different computer languages at the same time requires a structured approach. Free tutorial sites are not going to teach you web browser programming, they are useful for explaining small portions of the overall language but there is little variation between them. I sometimes feel that they just copy and paste from the same source.
Better to subscribe to an online learning site, then if you do not understand something there is someone there who is paid to answer student queries.
Point 2: When someone answers your question and provides a reference, it behoves you to at least visit the resource. m3g4p0p sent you two references and judging from your response you either didn’t consult it or didn’t understand it.
Point 3: Wisdom comes from researching why a code snippet does not work as expected. Program execution is very pedantic. It will do exactly what the code says. If an object method fails then either it is not being invoked correctly, or not being fed the correct parameters, or the object does not have that method, or there is something wrong with the object. In short it is your code that is wrong, not the interpreter.
One of the computer language gurus, Nicholas Wirth’s " Algorithms + Data Structures = programs", is a computer reference produced by a man who created several computer languages. That will inform you on the basics of computer programming.

2 Likes

I understand that I don’t teach here, just as they can’t teach, but in schools I don’t know why people pay money, but I think if a person understands his business, he should be able to explain, because For example, in programming it’s almost impossible for me to explain , since my opinion, like that of hundreds of students, is different, and it is still not possible to understand this.