const dbref=ref(db);
get(child(dbref,"TheStudents")).then((snapshot)=>{
snapshot.forEach((doc)=>{
$("#languages").append('<a href="#'+doc.val().Number+'" class="filterDiv '+doc.val().Section+' show" id="'+doc.val().Title+'">' +doc.val().Title+ '</a>'+'<div id="'+doc.val().Number+'" class="modal-window"><div><a href="#" title="Close" class="modal-close">Close</a><h1 id="title">'+doc.val().Title+'</h1><h2 id="author">'+doc.val().Author+'</h2><h3 id="pages">'+doc.val().Pages+'</h3><h3 id="roll">'+doc.val().Number+'</h3> <h3 id="shelf">'+doc.val().shelf+'</h3> <h3 id="borrower">'+doc.val().borrower+'</h3><div id="description">'+doc.val().Description+'</div><br><button id="butt" onclick="borrow(\''+ currentUser.borrowed+'\',\''+ doc.val().borrower+'\',\''+ currentUser.username+'\',\''+ currentUser.fullname+'\',\''+ doc.val().Number+'\')">Borrow</button></div></div>');});
});
I am a beginner and getting hands ready on web developing. The thing is, I am working with firebase database and i need a function declared inside the outside the script ,and also it should be onclick function. Plz help me with this.