Reference error : Browser not defined

I am trying to add event listener using this code

document.addEventListener(‘DOMContentLoaded’, function() {
var elems = document.querySelectorAll(’.collapsible’);
var instances = M.Collapsible.init(elems, options);
});

from https://materializecss.com/collapsible.html

but it is not working and showing browser not defined uncaught reference error. pls help

Hello,

Actually the materialize css documentation is quite confusing! While calling the JS function M.Collapsible.init(elems, options)
elems is defined but options is not.

What you can do is define an empty JS object

document.addEventListener(‘DOMContentLoaded’, function() {
var elems = document.querySelectorAll(’.collapsible’);
var options = {}
var instances = M.Collapsible.init(elems, options);
});

or may be just skip it

document.addEventListener(‘DOMContentLoaded’, function() {
var elems = document.querySelectorAll(’.collapsible’);
var instances = M.Collapsible.init(elems);
});