I have created a boxInfo object below. Inside it, I have created a function, leftPos which is an IIFE and I am passing the value to this function. However, I am getting undefined. When I simply pass this, it manages to pass the whole object. But when I try to narrow down, using dot operator it returns undefined.
I am trying to pass
SimpleShow.init = function (el, options) {
self = this;
//Selects the slider box
self.box = document.querySelector(el);
//Creates the array of all the items in the slider
self.slides = document.querySelector(el + "> ul").children;
//facing the problem below
self.boxInfo = {
heightBox: self.box.offsetHeight,
widthBox: self.box.offsetWidth,
//trying to pass this proeprty to function below
totalWidth: self.box.offsetWidth * self.slides.length,
//Calculates the starting points for each slides
leftPos: ((totalWidth) => {
//Testing what value is being passed inside - Getting undefined
console.log(totalWidth);
})(this.boxInfo.totalWidth) //this is not passing the property
}
initBox(self.box, self.slides, self.boxInfo );
startSlideShow();
}