Very Large Delay Value In setTimeout
Have you tried giving large value in serTimeout ?

CapsCode: Empowering Innovation Through Education and Technology
CapsCode is a pioneering edtech and web development company committed to transforming the lives of students and businesses alike. Founded with the vision of creating a brighter, tech-driven future, CapsCode empowers students by providing world-class coding education while enabling businesses to achieve their goals with cutting-edge IT solutions.
For Students At CapsCode, we believe that coding is the language of tomorrow. Through engaging and industry-relevant courses, personalized mentoring, and hands-on workshops, we help students develop: Problem-solving skills: Preparing them for real-world challenges. Technical expertise: Equipping them with practical knowledge of coding and web development. Confidence in technology: Making them future-ready for careers in IT and beyond.
We foster an environment where students not only learn to code but also learn to innovate, collaborate, and think critically.
For Businesses CapsCode offers bespoke IT solutions tailored to the unique needs of businesses. From responsive web development to advanced digital marketing strategies, our services are designed to help companies grow their online presence and streamline their operations. Our key offerings include: Custom website and software development E-commerce platform creation Lead generation and digital marketing Professional email and Google Business setup
We act as partners in innovation, helping businesses leverage technology to reach new heights.
Our Mission Our mission is to empower individuals and organizations by bridging the gap between technology and accessibility. We aim to inspire a new generation of coders while helping businesses thrive in a competitive digital landscape.
Why Choose CapsCode? Over 9 years of IT industry expertise. A blend of education and professional IT services under one roof. A commitment to fostering growth, innovation, and success.
Join us in shaping the futureโwhether you're a student eager to unlock your potential or a business ready to embrace the possibilities of technology.
Learn. Build. Grow. With CapsCode.
Hello Dev,
In this article, I will explain you 1 very important limitation of setTimeout in JavaScript.
Browsers including Internet Explorer, Chrome, Safari, and Firefox store the delay as a 32-bit signed integer internally. This causes an integer overflow when using delays larger than 2,147,483,647 ms (about 24.8 days), resulting in the timeout being executed immediately.
function func(){
setTimeout(()=>{
console.log('Print hello after 2,147,483,648 milliseconds')
}, 2147483648)
}
func()
Expected output/ behavior for the above code should be the callback function of setTimeout will execute after 2,147,483,648 milliseconds.
But the callback function will get executed immediately because the maximum delay value in setTimeout is 2,147,483,647 milliseconds and we have provided 2,147,483,648 milliseconds as delay.
Thank you for reading this so far. This is a brief introduction on How Large Delay Value In setTimeout Acts in JavaScript.
Hope it's a nice and informative read for you. If you find this article useful, like and share this article. Someone could find it useful too.
If you find anything technically inaccurate, please feel free to reach out to us.
VISIT https://www.capscode.in/blog TO LEARN MORE.
See you in my next Blog article, Take care!!
Thanks, CapsCode




![Difference between __proto__, [[Prototype]] & .prototype in JavaScript](https://cdn.hashnode.com/res/hashnode/image/upload/v1748159626406/69c8f1f2-2e84-4bd4-8abb-dc14ace2464a.png)

