JavaScript 2022

Term 3 Wednesday

May - July 2022

This site will be updated live during the sessions

Week 5 4 Exercise 1

JavaScript Week 5 Exercise 1

Cheese of the UK

Banbury

Once one of Banbury's most prestigious exports, and nationally famous, its production went into decline by the 18th-century, and eventually ceased. The cheese is best known today through an insult in Shakespeare's Merry Wives of Windsor (1597).

Cheddar

The UK's most famous cheese, and one of the most popular. Aging is the only difference between mild and sharp Cheddars. The longer cheese is aged naturally, the sharper and more pronounced the Cheddar flavor becomes. Mild Cheddar cheese is generally aged for 2 to 3 months, whereas an extra sharp might be aged for as long as a year.

Stilton

Stilton is produced in two varieties: Blue, which has had Penicillium roqueforti added to generate a characteristic smell and taste, and White, which has not. Stilton is only made in three Counties in England: Derbyshire, Nottinghamshire and Leicestershire, and is is a protected cheese. Stilton is protected by a Certification Trade Mark and EU Protected Designation of Origin (PDO).

Stinking Bishop

Perhaps the UK's most notorious cheese, known for its distinctive odour. The colour of Stinking Bishop ranges from white/yellow to beige, with an orange to grey rind. It is moulded into wheels 2 kilograms (4.4 lb) in weight, 20 centimetres (7.9 in) in diameter, and 4 centimetres (1.6 in) deep. Only about 20 tonnes are produced each year. The distinctive odour comes from the process with which the cheese is washed during its ripening; it is immersed in perry made from the local Stinking Bishop pear (from which the cheese gets its name) every four weeks while it matures. To increase the moisture content and to encourage bacterial activity, salt is not added until the cheese is removed from its mould.

		
001window.onload = function(){	
		
002	// starting search in header element with the ID mainContnent
		
003	// get main element
		
004	const headerElement = document.getElementById('headerElement');
		
005	// look for first h2
		
006	
		
007	const heading2 = headerElement.querySelector('h2');
		
008	// get the value of the h2 found's id
		
009	const heading2Attribute = heading2.getAttribute('id');
		
010	// log it
		
011	console.log("The id for the first h2 found is: " + heading2Attribute);
		
012	
		
013	// change the id attribute
		
014	heading2.setAttribute('id','heading2')
		
015	// get the id attribute value again!
		
016	const newHeading2Attribute = heading2.getAttribute('id');
		
017	// log the id attribute value again
		
018	console.log("The id for the first h2 found is: " + newHeading2Attribute);
		
019	
		
020	// using style to add to the (inline) css
		
021	heading2.style.color = 'red';
		
022	
		
023	const heading2Text = heading2.innerHTML; // Cheese of the UK
		
024	console.log(heading2Text);
		
025	heading2.innerHTML = "A selection of cheese from the UK";
		
026}