JavaScript 2022

Term 3 Wednesday

May - July 2022

This site will be updated live during the sessions

Week 6 Exercise 1

JavaScript Week 6 Exercise 1

Cheese of the UK

Banbury cheese

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).

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).

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).

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 cheese

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.

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 Cheese

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).

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 Cheese

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.

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
		
003	// start search position for h2 nodes (as there are h2's in the html above!)
		
004	const containerDiv = document.getElementById('pagewrapperLight');
		
005	// We create a collection of all the H2 nodes in div
		
006	const headingsElements = containerDiv.getElementsByTagName('h2');
		
007
		
008	// Get target section to place list
		
009	const targetElement = document.getElementById('cheese-list');
		
010
		
011	// We create the UL Node that wil hold the list items
		
012	const ulElement = document.createElement('ul');
		
013
		
014	 //Go through the h2 node collection and 
		
015	// for each node found, we create 
		
016	// 1)  create a new LI element
		
017	// 2)  create a new text Node - using the H2 node inner text
		
018	// 3)  append the  text node to the LI element created
		
019	// 4)  append the LI with text to the UL element created
		
020	
		
021	for(let i = 0; i < headingsElements.length; i++)
		
022	{ 
		
023
		
024/*1*/	const liElement = document.createElement('li');
		
025/*2*/	const liText = document.createTextNode(headingsElements[i].innerText);
		
026/*3*/	liElement.appendChild(liText);
		
027/*4*/	ulElement.appendChild(liElement);
		
028	 }
		
029
		
030	//the new ul with the list is appended to the DOM!
		
031	targetElement.appendChild(ulElement);
		
032}