JavaScript 2022

Term 3 Wednesday

May - July 2022

This site will be updated live during the sessions

Week 1 Example 2

		
001// JavaScript example 2
		
002
		
003console.log("my name is Peter");
		
004let result;
		
005let num1 = 100;
		
006let num2 = 4;
		
007console.log(num1 / num2);
		
008console.log(num1 * num2);
		
009result = num1/3;
		
010
		
011// to fixed function displays the value, as a string, to 
		
012// the number of decimal places sent in as an arguement.
		
013console.log(result.toFixed(2));
		
014console.log(result);
		
015if(num1 > num2)//true
		
016{
		
017	let string1 = "hi";
		
018	console.log(string1);
		
019	console.log("num1 has a value stored higher than num2");	
		
020}
		
021else
		
022{
		
023	console.log("num2 has a value stored higher than num1");
		
024}
		
025console.log(string1);