if (collectiveDevotionEffect === 1) { if (collectiveTrustEffect === 1) { r.push(`Since ${he}'s ambivalent and fearful, the <span class="devotion inc">collective devotion</span> <span class="trust inc">and trust</span> of your slaves affect ${him} slightly.`); } else if (collectiveTrustEffect === 0) { r.push(`Since ${he}'s ambivalent about you, the <span class="devotion inc">collective devotion</span> your slaves feel for you affects ${him} slightly.`); } else { r.push(`Since ${he}'s ambivalent about you, the <span class="devotion inc">collective devotion</span> your slaves feel for you affects ${him} slightly, but their <span class="trust dec">general fear</span> affects ${him} too.`); } } else if (collectiveDevotionEffect === 0) { if (collectiveTrustEffect === 1) { r.push(`Since ${he}'s fearful of you, the <span class="trust inc">collective trust</span> your slaves place in you affects ${him} slightly.`); } else if (collectiveTrustEffect === -1) { r.push(`Since ${he} doesn't trust you, the <span class="trust dec">collective fear</span> your slaves feel for you affects ${him} slightly.`); } } else { if (collectiveTrustEffect === 1) { r.push(`The <span class="devotion dec">collective anger</span> your slaves feel reinforces ${his} own feelings, but their <span class="trust inc">collective trust</span> also affects ${him} slightly.`); } else if (collectiveTrustEffect === 0) { r.push(`The <span class="devotion dec">collective anger</span> your slaves feel reinforces ${his} own feelings.`); } else { r.push(`The <span class="devotion dec">collective anger</span> <span class="trust dec">and fear</span> your slaves feel reinforce ${his} own feelings.`); } }
Doing
if (collectiveDevotionEffect === 1) { if (collectiveTrustEffect === 1) { r.push(`Since ${he}'s ambivalent and fearful, the <span class="devotion inc">collective devotion</span> <span class="trust inc">and trust</span> of your slaves affect ${him} slightly.`); } else if (collectiveTrustEffect === 0) { r.push(`Since ${he}'s ambivalent about you, the <span class="devotion inc">collective devotion</span> your slaves feel for you affects ${him} slightly.`); } else { r.push(`Since ${he}'s ambivalent about you, the <span class="devotion inc">collective devotion</span> your slaves feel for you affects ${him} slightly, but their <span class="trust dec">general fear</span> affects ${him} too.`); } } else if (collectiveDevotionEffect === 0) { if (collectiveTrustEffect === 0) { r.push(`<span class='red'>AAAAAAAAAAAAAA</span>`); } else if (collectiveTrustEffect === 1) { r.push(`Since ${he}'s fearful of you, the <span class="trust inc">collective trust</span> your slaves place in you affects ${him} slightly.`); } else if (collectiveTrustEffect === -1) { r.push(`Since ${he} doesn't trust you, the <span class="trust dec">collective fear</span> your slaves feel for you affects ${him} slightly.`); } } else { if (collectiveTrustEffect === 1) { r.push(`The <span class="devotion dec">collective anger</span> your slaves feel reinforces ${his} own feelings, but their <span class="trust inc">collective trust</span> also affects ${him} slightly.`); } else if (collectiveTrustEffect === 0) { r.push(`The <span class="devotion dec">collective anger</span> your slaves feel reinforces ${his} own feelings.`); } else { r.push(`The <span class="devotion dec">collective anger</span> <span class="trust dec">and fear</span> your slaves feel reinforce ${his} own feelings.`); } }
Produces
so the undefined seemed to be produced before this point.
After only commenting out retirementThoughts(slave);
the undefined is not present.