I have a variable called loopNum which returns as an object in console. The other variables return as expected. Can anyone explain why this is happening? Thanks
Script
// stores how many carousels there are
var carouselNum = $('.carousella').length;
// stores the product of number of carousels times the increment value
var loopNum = $((carouselNum - 2) * -183);
console.log('loopNum = ' + loopNum);
console.log('carouselNum = ' + carouselNum);
Console
loopNum = [object Object]
Don't wrap the carouselNum variable into a jQuery wrapper $() after assigning it. Try this:
var carouselNum = $('.carousella').length;
// stores the product of number of carousels times the increment value
var loopNum = (carouselNum - 2) * -183;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With