Insert a "Go Back" button

I was looking for a way to "Go Back" to the previous screen, in this case for a number of drill-down reports. The script inserts a button with go-back function to the current view, as determined by "view.key".

// Add go back button to a set of views
$(document).on("knack-view-render.any", function(event, view) {
var appviews=["view_32","view_43","view_62"];
var key=(view.key!=undefined)?view.key.toLowerCase().trim():"";
var l=appviews.length;
for (var x=0; x<l; x++) {

if (appviews==key) {
$(’#’+appviews).prepend("<button id=‘button’>Go Back</button>");
document.getElementById(‘button’).addEventListener(‘click’, function() {

}; // if
}; // for