Need Help with Integer-to-Variable

But the value has been set. I set the stored session value on the actual webpage. The lightbox then gets the stored value, which is then used to change slides in the slider in the lightbox.

As a test, I created a variable that gets the value stored in session storage. I then reset the session storage value using the created variable. This is redundant, of course, but I did this so that “set” and “get” are in the same body of code. Then, I created yet another variable called “num,” based on the reset session variable.

Still doesn’t work.

The “changeSlide” operation doesn’t seem to like it when the value of the variable its using is passed from storage.

Not sure what to do next. Here’s the test code described above:


import {session} from 'wix-storage';

var galImage = session.getItem("galImage"); // variable created from page storage 
 
$w.onReady(function () {
    session.setItem("galImage", galImage); // stored variable reset (set/get same page)
    let num = session.getItem("galImage"); // new variable from reset storage
    $w("#slideshow1").changeSlide(num);    // correction mark under "num" (!shown here)
});

This is silly, I know. All I’m doing is trying to have the “set” and “get” in the same body of code to test whether or not the “changeSlide” operator simply doesn’t like values passed from storage. It appears to be the case.

Perhaps I’m missing something. Figuring this out will save many lines of code.