JavaScript 2022

Term 3 Wednesday

May - July 2022

This site will be updated live during the sessions

Week 7 Example 4 Bad Scope

		
001function aLoopingMessage()
		
002{
		
003	let loops = 10;
		
004	let i = 0;
		
005	let message = "";
		
006	for(i = 0; i < loops; i++)
		
007	{
		
008		message = "Msg #" + i;
		
009		console.log(message);
		
010	}
		
011	console.log(`The value of i is ${i} outside the loop`);
		
012}
		
013window.onload = aLoopingMessage;