Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This example solve the entire post problem using ES6 'let' keyword
- for(let i = 0; i < 10; i++) {
- setTimeout(() => {
- console.log(`The number is ${i}`);
- }, 1000);
- }
- /*
- # Output should be show below type:
- The number is 0
- The number is 1
- The number is 2
- The number is 3
- The number is 4
- The number is 5
- The number is 6
- The number is 7
- The number is 8
- The number is 9
- */
Add Comment
Please, Sign In to add comment