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

251
Views
JavaScript entering IF Statement that's not true

I am currently debugging a code I've not written and am generally not very experienced with JavaScript, but I am quite puzzled with this one. Why is the Script entering the second if Statement, when the condition is not true? :o

Code:

onChangeMinVotes(event) {
            console.clear()
            console.log("START");
            console.log("event.target.value: " + event.target.value);
            console.log("numberOfThemen: " + this.numberOfThemen);
            console.log("this.min_votes: " + this.min_votes);
            console.log("BEFORE UPDATE");
            this.update()
            console.log("AFTER UPDATE");
            console.log("event.target.value: " + event.target.value);
            console.log("numberOfThemen: " + this.numberOfThemen);
            console.log("this.min_votes: " + this.min_votes);
            console.log("BEFORE IF");
            if (event.target.value <= 0) {
                console.log("IF 1");
                this.min_votes = 1
            } else if (event.target.value > this.numberOfThemen) {
                console.log("IF 2");
                console.log("event.target.value: " + event.target.value);
                console.log("numberOfThemen: " + this.numberOfThemen);
                $('#myModal').modal("show")
                //this.min_votes = this.numberOfThemen
            } else if (event.target.value > 10) {
                console.log("IF 3");
                this.min_votes = 10
            }
            console.log("AFTER IF");
            console.log("event.target.value: " + event.target.value);
            console.log("numberOfThemen: " + this.numberOfThemen);
            console.log("this.min_votes: " + this.min_votes);
            console.log("END");
        },

Console Output:

Konsole wurde geleert. 
START 
event.target.value: 3 
numberOfThemen: 20 
this.min_votes: 3 
BEFORE UPDATE 
AFTER UPDATE 
event.target.value: 3 
numberOfThemen: 20 
this.min_votes: 3 
BEFORE IF 
IF 2 
event.target.value: 3 
numberOfThemen: 20 
AFTER IF 
event.target.value: 3 
numberOfThemen: 20 
this.min_votes: 3 
END 
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!