JSFiddle - React, Tailwind, and code Playground
HTML
<div id="addMeHelper">
</div>
JavaScript
/// (c) zqom all right reserved. do not copy
// or remove copyright
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see //<http://www.gnu.org/licenses/>.
// body cannot change
const body = $('#addMeHelper')
function addMe(a, b){
let repeater = function repeat(fn, times) {
for(var i = 0; i < times; i++) fn();
}
jQuery(function () {
//assign to const so it does not change
const number_one = a
const nr_2 = b
repeater(function(){
$(body).after($('<a>'))
}, number_one)
repeater(function(){
$(body).after($('<a>'))
}, nr_2)
const resutl = $('a').length
debugger
alert(resutl);
})
}
addMe(5, 4)