This task should be quite straightforward.
Using Vanilla JS, I am trying to update the content of a span element with the session ID obtained from a function call.
Here's an example:
sessionId = 0_77b1f7b5-b6c8-49a0-adbc-7883d662ebba
document.getElementById("sessionID").innerHTML = sessionId
However, when I run this code in my HTML/JS files, it doesn't seem to have any effect.
Running the same snippet in the Browser Console produces the following error message (observed in Firefox and Chrome):
Uncaught SyntaxError: numeric separators '_' are not allowed in numbers that start with '0'
I require the session ID to retain its original format (with '0' and underscore).
After consulting the Firefox documentation (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Identifier_after_number), I learned that enclosing the value in quotation marks like '0_77b1f7b5-b6c8-49a0-adbc-7883d662ebba' resolves the issue.
However, when attempting to convert this data into a string using String(), I encounter difficulties.
Object { sessionId: "0_77b1f7b5-b6c8-49a0-adbc-7883d662ebba", modules: (1) […] }
sessionId = String(setupCompleteData.sessionId)
console.log("TEST : ", sessionId)
TEST : 0_77b1f7b5-b6c8-49a0-adbc-7883d662ebba
Do you have any suggestions on how to work around this issue?
Thank you very much!