Few days after since I started to make the plugin, I wondered what's the difference between these 2 codes and why second code doesn't work.
The first one looks like this:
<div class="searching">
    <ul>
        <li></li>
    </ul>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
(function($) {
  $.fn.slideInit = function() {
    const myGallery = $(this),
          myList = myGallery.find('li');
    <!-- Log Section -->
    console.log(myList);
    <!----------------->
  };
} (jQuery));
$('.searching').slideInit();
This code works fine what I expected. Variable myGallery can be defined inside of the code block.
And the second one which doesn't work looks like this:
(function($) {
  $.fn.slideInit = function() {
    const defaults = {
      myGallery: $(this),
      myList: myGallery.find('li')
    };
    <!-- Log Section -->
    console.log(defaults.myList);
    <!----------------->
  };
} (jQuery));
$('.searching').slideInit();
What I've done in this code is just added the variables inside of an object which called defaults, but when I run this code, an error pops up:
index.html:59 Uncaught ReferenceError: myGallery is not defined
I think there's something difference between those 2 codes but couldn't find or figured out by myself.
Would you guys teach me why the myGallery that is scoped by the variable default can't be defined?
 
     
    