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

115
Views
¿Por qué el valor resultante de una combinación de operaciones lógicas contradice a cada una de ellas por separado?

Mi código JS para mostrar la ventana modal en función de los valores.

Cuando saco valores de event.pageY < 30 , isMovingUp(event) , event.movementY < 0 por separado, todos ellos son iguales a true pero event.pageY < 30 && event.movementY < 0 && isMovingUp(event) es igual a false . ¿Por qué es así?

 const showModalBeforeOut = (event) => { const headerBlock = document.querySelector("#header"); console.log(`${event.pageY < 30}`); console.log(`${isMovingUp(event)}`); console.log(`${event.movementY < 0}`); if (event.pageY < 30 && event.movementY < 0 && isMovingUp(event)) { console.log(`logical value of expression is: ${event.pageY < 30 && isMovingUp(event) && event.movementY < 0}`); let modalTextContent = "Don't leave the site!"; let isCookieExists = checkCookie('max-age') if (!isCookieExists) { // if there is no cookie here at first display modal window and after initialize cookie with value `max-age` displayPopup(modalTextContent); document.cookie = 'max-age=15' if (document.body.contains(document.querySelector('.question-p'))) { const targetElement = document.querySelector('.question-p') targetElement.textContent = "Leaving already?" } } } }
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!