So this is very weird, I have a foreach function like this:
let cookieValue = '';
cookieList.forEach(function(cookieItem) {
const cookieParts = cookieItem.split('=');
const value = cookieParts[1];
const key = cookieParts[0];
if (key.trim() === cookieName) {
cookieValue = value;
return cookieValue;
}
});
return cookieValue;
which works fine, however when I change the lines inside the if statement to a single line:
return value;
It returns undefined always.
Any ideas of what can be happening here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…