diff --git a/js/src/collapse.js b/js/src/collapse.js
index 8894342dfc29a7ac5b26b8ba28298a75fa10cfc0..b1088e106fb7e164a00b2a62de510aa49fdae67d 100644
--- a/js/src/collapse.js
+++ b/js/src/collapse.js
@@ -256,12 +256,12 @@ class Collapse extends BaseComponent {
 
   // Static
   static jQueryInterface(config) {
-    return this.each(function () {
-      const _config = {}
-      if (typeof config === 'string' && /show|hide/.test(config)) {
-        _config.toggle = false
-      }
+    const _config = {}
+    if (typeof config === 'string' && /show|hide/.test(config)) {
+      _config.toggle = false
+    }
 
+    return this.each(function () {
       const data = Collapse.getOrCreateInstance(this, _config)
 
       if (typeof config === 'string') {