---
title: "Discussion on \"JavaScript: Print 10 numbers with a delay of 3 seconds\" | Hashnode"
description: "Discussion on \"JavaScript: Print 10 numbers with a delay of 3 seconds\". // Method 1\nfor (let i =1; i<=5; i++) {\n      setTimeout(function() {\n      console.log(i)\n      }, i * 3000);\n  }\n\n// Method 2\nfor (var i =1; i<=5; i++) {\n    (function foo(i) {\n      setTimeout(function() {\n      console.log(i)\n      }, i * 3000);\n..."
url: "https://hashnode.com/posts/javascript-print-10-numbers-with-a-delay-of-3-seconds/630b1cd656df9e8e5024de67"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [JavaScript: Print 10 numbers with a delay of 3 seconds](https://harikrishna.hashnode.dev/javascript-print-10-numbers-with-a-delay-of-3-seconds?utm_source=hashnode&utm_medium=feed)

// Method 1 for (let i =1; i<=5; i++) { setTimeout(function() { console.log(i) }, i \* 3000); } // Method 2 for (var i =1; i<=5; i++) { (function foo(i) { setTimeout(function() { console.log(i) }, i \* 3000); ...

Jan 1, 2022 · 1 min read · harikrishna.hashnode.dev  
Read the article

-   [#settimeout](https://hashnode.com/tag/settimeout)
-   [#setinterval](https://hashnode.com/tag/setinterval)
-   [#clearinterval](https://hashnode.com/tag/clearinterval)

## Written by

[Hari Krishna Anem](https://hashnode.com/@hkrishna)

@hkrishna · Hyderabad, India

  
[View profile](https://hashnode.com/@hkrishna)

Full stack developer

Full stack developer (ReactJS, NodeJS, JavaScript, PHP, SQL)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
