This my subscribe code i want to get the channelid so i used this.channel in the code but i got undefined. Is there any way that i can get channelid
pubnub.subscribe({
    channel: changing dynamically,
    presence: function (m) {
        console.log(m)
    },
    message: function (m) {
        console.log(m);
        console.log("Channel ==" + this.channel)
    },
    error: function (error) {
        // Handle error here
        console.log(JSON.stringify(error));
    }
})
result: Channel==undefined
 
                        
Looking at the fine manual, this should work:
In other words, the channel is passed as argument to the
messagecallback.The most likely reason for
this.channelbeing undefined is that themessagecallback isn't called in the context of the object that is passed topubnub.subscribe().