elements.searchResPages.addEventListener ('click', e =>{
    const btn = e.target.closest ('. btn-inline');
    if (btn) {
        const goToPage = parseInt (btn.dataset.goto, 10);
        searchView.clearResults ();
        searchView.renderResults (state.search.result, goToPage);
        console.log (goToPage);

What are you doing in this const goToPage = parseInt (btn.dataset.goto, 10);scene?
I knew that datset was related to Dom, but I couldn't understand it in detail, so I asked a question.
I would appreciate your teaching.

  • Answer # 1



    Button custom data goto value
    If it is an attribute, it is the value set in data-goto.

  • Answer # 2

    datasetproperty is exactly as in yambejp's answer.

    The details of the

    parseIntmethod are described in the following article.

    parseInt ()-JavaScript | MDN

    This methodreturns the value assigned to the first argument to aninteger valuemethod.
    The second argument is theradix (the base of mathematical notation).
    This time,10is put in the second argument, so the purpose is to return a decimal number.

    That means that the value of dataset.goto is converted to a decimal number.