Tell us what’s happening:
I’ve been working on this ternary operator for a while now. I first began with return hit > 0 ? score : default_score
and that did not work then I checked the forum which got me to return hit > 0 ? hit : default_hit
but that did not work either. I realized that the other help posts seemed to be for another step , placed under step 149 maybe because the course changed a little and the steps changed? And there might not be that many questions on this particularly, so I thought to ask
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
function getMonsterAttackValue(level) {
const hit = (level * 5) - (Math.floor(Math.random() * xp));
console.log(hit);
return hit > 0 ? hit : default_hit ;
}
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 149