Asking and checking if the answer is correct So I'm very new if JavaScript and my question is this a right way to implement this functionality? How could I improve this code.
&lt;!DOCTYPE html&gt;

&lt;html lang=&quot;en&quot;&gt;
    &lt;head&gt;
        &lt;title&gt;TEST&lt;/title&gt;
        &lt;script&gt;

            document.addEventListener('DOMContentLoaded', function() {

                let correct = document.querySelector('.correct');
                correct.addEventListener('click', function() {
                    correct.style.backgroundColor = 'green';
                    document.querySelector('#A1').innerHTML = 'Правильно';
            });

            let incorrects = document.querySelectorAll('.incorrect');
            for (let i = 0; i &lt; incorrects.length; i++) {
                incorrects[i].addEventListener('click', function() {
                    incorrects[i].style.backgroundColor = 'red';
                    document.querySelector('#A1').innerHTML = 'Неправильно';

                });
            }
    
             document.querySelector('.check').addEventListener('click', function() {
                 let input = document.querySelector('input');
                 if (input.value === '17') {
                     input.style.backgroundColor = 'green';
                     document.querySelector('#A2').innerHTML = 'Правильно';
                 } else {
                     input.style.backgroundColor = 'red';
                     document.querySelector('#A2').innerHTML = 'Неправильно';
                 }
             });
           });
        &lt;/script&gt;

    &lt;/head&gt;
    &lt;body&gt;
                &lt;h1&gt;TEST&lt;/h1&gt;
        &lt;section&gt;
            &lt;article&gt;
                &lt;hr&gt;
                &lt;h3&gt;How many times can you subtract 6 from 30?&lt;/h3&gt;
                &lt;button class=&quot;incorrect&quot;&gt;ДВА РАЗA&lt;/button&gt;
                &lt;button class=&quot;incorrect&quot;&gt;ЧЕТЫРЕ РАЗA&lt;/button&gt;
                &lt;button class=&quot;incorrect&quot;&gt;ТРИ РАЗA&lt;/button&gt;
                &lt;button class=&quot;incorrect&quot;&gt;ШЕСТЬ РАЗ&lt;/button&gt;
                &lt;button class=&quot;correct&quot;&gt;ПЯТЬ РАЗ&lt;/button&gt;
                &lt;p id=&quot;A1&quot;&gt;Сколько раз вы можете вычесть 6 из 30?&lt;/p&gt;
            &lt;/article&gt;
            &lt;article&gt;
                &lt;hr&gt;
                &lt;h3&gt;What number should be subtracted from each of 50, 61, 92, 117 so that the numbers, so obtained in this order, are in proportion ?&lt;/h3&gt;
                &lt;input type=&quot;text&quot;&gt;&lt;/input&gt;
                &lt;button class=&quot;check&quot;&gt;Check&lt;/button&gt;
                &lt;p id=&quot;A2&quot;&gt;Какое число нужно вычесть из 50, 61, 92, 117, чтобы числа, полученные в таком порядке, были пропорциональны?&lt;/p&gt;
            &lt;/article&gt;
        &lt;/section&gt;
    &lt;/body&gt;
&lt;/html&gt;
Congrats on getting something like this working! I obviously don't know anything about the background of the project, so keep in mind that while my feedback may be valuable, if it's just a small side project you might not want to overengineer it.
Regardless, here are some points for you to regard:

External scripts: While embedding scripts into the document directly is a slight performance gain, using an external script gives you the luxury of

Mixed languages: While mostly an oddity while reading, it's generally a bad user experience to have two languages mixed together. For concistency in terms of UX, I'd advise that you stick to either one.

Reducing duplicated code: When writing code, it's always nice that if you have to change something, you only have to change it in one place, instead of multiple. This makes your code less error prone to spontaneous changes made by you. Considering this, we could refactor the following:


let input = document.querySelector('input');
if (input.value === '17') {
    input.style.backgroundColor = 'green';
    document.querySelector('#A2').innerHTML = 'Правильно';
} else {
    input.style.backgroundColor = 'red';
    document.querySelector('#A2').innerHTML = 'Неправильно';
}

... into ...
const input = document.querySelector('input');
const answer = document.querySelector('#A2');

if (input.value === '17') {
    input.style.backgroundColor = 'green';
    answer.innerHTML = 'Правильно';
} else {
    input.style.backgroundColor = 'red';
    answer.innerHTML = 'Неправильно';
}


HTML cleanup: If you need to query the document to fetch elements, it's always good to be as explicit as possible. On one line you are querying for input, but what if the page contains multiple input elements later? You should try to get a consistent and explicit HTML structure going for the questions/answers (which also ties in with the point made later on below). An example could be this:

&lt;article id=&quot;q1&quot; class=&quot;question&quot;&gt;
    &lt;hr&gt;
    &lt;h3&gt;...&lt;/h3&gt;
    &lt;input type=&quot;text&quot;&gt;&lt;/input&gt;
    &lt;button class=&quot;check&quot;&gt;Check&lt;/button&gt;
    &lt;p class=&quot;answer&quot;&gt;...&lt;/p&gt;
&lt;/article&gt;

Each of the elements in this node can be uniquely identified simply by the fact that they are a child of the unique(!) question element with the ID &quot;q1&quot;. Queries that looked for input before would now look for #q1 &gt; input instead.
You could also try to remove redundant classes, unless they are used for styling. In the first question, there is one button with the &quot;correct&quot; class, with all others being &quot;incorrect&quot;. But the fact that every button that is not explicitely &quot;correct&quot; should be incorrect should be natural, hence you could consider removing these excessive classes.

The points mentioned above will probably increase the overall readability and maintainability of the project, but the biggest concern currently is the extendibility.
Look at it this way: Currently, every time you want to add a new question to the quiz, you need to modify your source code, mostly adding duplicated statements to check correct/incorrect answers. If you give your questions a more concrete structure, you could write reusable code, that is valid for any question that you add!
The exact implementation for this is up to you, but it could help to generate an object from an HTML node, grabbing the question title, description, answering possibilities (and the correct one obviously!) and setting up the question/answer handling.
Always remember: It's almost always better to have something that is extendible and/or scalable without having to modify the source code, just by modifying the markup or configuration.