Answer the question
In order to leave comments, you need to log in
What to do if you can’t write code with the right knowledge?
Hello, thank you for reading this, in general, I have encountered such a problem that I am not the first to study programming and, as a rule, I do not go far.
This time I lasted longer than usual, but the problems are about the same.
Now I'm learning from a list of basic lessons by type: variables, operators, functions, and so on. And most of the topics, in principle, are more than clear to me, as I think. But very often, when completing tasks, I am faced with the fact that I do not understand how to do it, although there is everything that I have already gone through.
But, if I see a solution to a particular task, then I immediately understand why certain actions were performed during the solution. But he himself, in the process of solving, did not even guess that this was possible, or he forgot certain intervals of the topic, which is necessary for solving the problem.
Tell me please, what do you think, the problem is that I spend little time on programming? Bad syntax? Or do you see the reason in something else?
Because it seems to me that if you know all the necessary topics for solving a particular problem at such a low level, you should be able to solve it.
Here is an example task:
// Объяви экспортируемую функцию getAvailableItems,
// которая принимает в качестве первого аргумента объект пользователя,
// а в качестве второго аргумента - массив объектов предметов,
// каждый элемент которого представляет из себя объект следующего вида:
// {
// name - строка (обозначает имя предмета)
// cost - число (обозначает цену предмета)
// }
// Пользователь представляет из себя объект следующего вида:
// {
// name - строка (обозначает имя пользователя)
// balance - число (обозначает баланс пользователя)
// }
// Функция getAvailableItems должна вернуть объект следующего вида:
// {
// availableItems - массив, каждый элемент которого представляет из себя объект предмета, описанный выше
// totalCost - число
// }
// В свойство availableItems возвращаемого объекта должен быть записан массив,
// который хранит в себе ближайшие к началу массива предметов предметы которые пользователю по карману
// Примечание: Эти предметы все вместе должны быть по карману для пользователя, а не отдельно,
// т.е. если у пользователя на балансе 500 условных единиц, то в массиве свойства availableItems
// общая стоимость предметов не должна превышать эти 500 условных единиц
// В свойство totalCost возвращаемого объекта должна быть записана сумма цен предметов,
// который суммарно по карману для пользователя. То есть это должна быть сумма цен предметов,
// записанных в массиве availableItems
Answer the question
In order to leave comments, you need to log in
I am faced with the fact that I do not understand how to do it, although there is everything that I have already gone through.
But, if I see a solution to a particular task, then I immediately understand why certain actions were performed during the solution.
but I don't know how to solve my problem.
My experience:
Studied JS from lessons and official documentation.
1. He knew perfectly well what a variable is, arrays, functions, cycles, etc. It is not clear how to apply this in practice.
2. I read O'relly's book for JS beginners - I began to understand even more about variables, loops, arrays, etc. - It's not clear how to apply it in practice
3. Signed up for advanced JS, NodeJS, React - studied ES6, learned classes, understood the principles of React - how to apply it in practice - it's not clear.
4. I bought several English-language courses on udemy (Russian in the furnace), where normal real projects are created, not "there sheets" and repeated everything after the author. The first course went through and repeated everything one to one, thanks to which I understood the interaction of React with Noda, how to write an API, how to deploy and everything. The second course has already been adapted to fit your needs. As a result, I made my project and only authorization and basic methods of creating and reading remained in the course from the project. 70 percent of your code.
As a result, you need practice and you need to practice on a whole project. Then comes the understanding of why this or that method/function is needed. And a lot of theory and hell understand why it is in practice - this is the prerogative of Russian-speaking mentors.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question