Encountering issues while trying to set a cookie using different methods:
Method 1:
document.cookie = name + "=" + value + "; expires=" + date.toUTCString() + "; path=/";
This method only sets the value up to "name=value" when I retrieve document.cookie.
Method 2:
document.cookie = "${name}=value";
document.cookie = "expires=${date.toUTCString()}";
document.cookie = "path=/";
This method works well and I am able to retrieve all values from the cookie by splitting with "";".
Why is there this strange behavior? The sonarqube report indicates that assigning document.cookie as shown in Method 2 is considered incorrect and flagged as a bug.