Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
How do I use addition and || in an if else statement?

This is what I am trying to accomplish but it is not working:

If the # on Dice 1 + Dice 2 equals 7, display “We have a Lucky 7!” Else If the # on Dice 1 or Dice 2 equals 6, display “We have a 6!” Else, display “We have no winner!”

This is the code I have written in javascript:

if(randomNumber1 += randomNumber2 === 7) {
document.querySelector("h1").innerHTML = "🚩 We have a lucky 7!";
}
else if (randomNumber2 || randomNumber1 === 6) {
document.querySelector("h1").innerHTML = "We have a 6! 🚩";
}
else {
document.querySelector("h1").innerHTML = "We have no winner!";
}

What am I doing wrong?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!