{"pageProps":{"code":{"array_advanced.js":{"name":"array_advanced.js","content":"const items = ['a', 'b', 'c', 'd', 'e'];\n\n// prints 0, 1, 2, 3, 4\nfor (const i in items) {\n  console.log(items[i]);\n}\n\n// prints a, b, c, d, e\nfor (const item of items) {\n  console.log(item);\n}\n\nconsole.log(items.includes('c'));\n","path":"code/1531/24T1/1.2/array_advanced.js","fileext":"js"},"array_basic.js":{"name":"array_basic.js","content":"const items = ['a', 'b', 'c', 'd', 'e'];\n\nlet i = 0;\nwhile (i < 5) {\n  console.log(items[i]);\n  i++;\n}\n\nfor (let j = 0; j < 5; j++) {\n  console.log(items[j]);\n}\n\nfor (let k = 0; k < items.length; k++) {\n  console.log(items[k]);\n}\n","path":"code/1531/24T1/1.2/array_basic.js","fileext":"js"},"arrays.js":{"name":"arrays.js","content":"// This is a array\nconst names = ['Hayden', 'Jake', 'Nick', 'Emily'];\n\nconsole.log(`1 ${names}`);\nconsole.log(`2 ${names[0]}`);\nnames[1] = 'Jakeo';\nnames.push('Rani');\nconsole.log(`3 ${names}`);\n","path":"code/1531/24T1/1.2/arrays.js","fileext":"js"},"combining.js":{"name":"combining.js","content":"const student1 = { name: 'Hayden', score: 50 };\nconst student2 = { name: 'Nick', score: 91 };\nconst student3 = { name: 'Emily', score: 99 };\nconst students = [student1, student2, student3];\n\nconsole.log(students);\n\n// Approach 1\nconst numStudents = students.length;\nfor (let i = 0; i < numStudents; i++) {\n  const student = students[i];\n  if (student.score >= 85) {\n    console.log(`${student.name} got an HD`);\n  }\n}\n\n// Approach 2\nfor (const student of students) {\n  if (student.score >= 85) {\n    console.log(`${student.name} got an HD`);\n  }\n}\n","path":"code/1531/24T1/1.2/combining.js","fileext":"js"},"compare_1.c":{"name":"compare_1.c","content":"int minimum(int a, int b) {\n  if (a > b) {\n  \treturn b;\n  } else {\n  \treturn a;\n  }\n}","path":"code/1531/24T1/1.2/compare_1.c","fileext":"c"},"compare_1.js":{"name":"compare_1.js","content":"function minimum(a, b) {\n  if (a > b) {\n    return b;\n  } else {\n    return a;\n  }\n}\n","path":"code/1531/24T1/1.2/compare_1.js","fileext":"js"},"compare_2.c":{"name":"compare_2.c","content":"#include <stdio.h>\n\nint minimum(int a, int b) {\n  if (a > b) {\n  \treturn b;\n  } else {\n  \treturn a;\n  }\n}\n\nint main(int argc, char* argv[]) {\n  printf(\"%d\\n\", minimum(3, 5));\n}","path":"code/1531/24T1/1.2/compare_2.c","fileext":"c"},"compare_2.js":{"name":"compare_2.js","content":"function minimum(a, b) {\n  if (a > b) {\n    return b;\n  } else {\n    return a;\n  }\n}\n\nconsole.log(minimum(3, 5));\n","path":"code/1531/24T1/1.2/compare_2.js","fileext":"js"},"control_structures.js":{"name":"control_structures.js","content":"const number = 5;\nif (number > 10) {\n  console.log('Bigger than 10');\n} else if (number < 2) {\n  // Do nothing\n} else {\n  console.log('Number between 2 and 9');\n}\n\nconsole.log('--------------------------');\n\nlet i = 0;\nwhile (i < 5) {\n  console.log('Hello there');\n  i += 1;\n}\n\nconsole.log('--------------------------');\n\nfor (let i = 0; i < 5; i++) {\n  console.log('Hello there');\n}\n","path":"code/1531/24T1/1.2/control_structures.js","fileext":"js"},"functions.js":{"name":"functions.js","content":"function getEvens(nums) {\n  const evens = [];\n  for (let i = 0; i < nums.length; i++) {\n    if (nums[i] % 2 === 0) { // Why is this not == ??\n      evens.push(nums[i]);\n    }\n  }\n  return evens;\n}\n\nconst allNumbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];\nconsole.log(getEvens(allNumbers));\n","path":"code/1531/24T1/1.2/functions.js","fileext":"js"},"intro.js":{"name":"intro.js","content":"const z = 3;\nfunction hello(a, b, c) {\n  return `${a} ${b}`;\n}\n","path":"code/1531/24T1/1.2/intro.js","fileext":"js"},"object_basic1.js":{"name":"object_basic1.js","content":"const userData = {};\nuserData.name = 'Sally';\nuserData.age = 18;\nuserData.height = '187cm';\nconsole.log(userData);\n","path":"code/1531/24T1/1.2/object_basic1.js","fileext":"js"},"object_basic2.js":{"name":"object_basic2.js","content":"const userData = {\n  name: 'Sally',\n  age: 18,\n  height: '187cm',\n};\nconsole.log(userData);\n","path":"code/1531/24T1/1.2/object_basic2.js","fileext":"js"},"object_loop1.js":{"name":"object_loop1.js","content":"const userData = [\n  {\n    name: 'Sally',\n    age: 18,\n    height: '186cm',\n  }, {\n    name: 'Bob',\n    age: 17,\n    height: '188cm',\n  },\n];\n\nconst keys = Object.keys(userData);\nconst entries = Object.entries(userData);\nconsole.log(keys);\nconsole.log(entries);\n","path":"code/1531/24T1/1.2/object_loop1.js","fileext":"js"},"object_loop2.js":{"name":"object_loop2.js","content":"const userData = [\n  {\n    name: 'Sally',\n    age: 18,\n    height: '186cm',\n  }, {\n    name: 'Bob',\n    age: 17,\n    height: '188cm',\n  },\n];\n\nfor (let i = 0; i < userData.length; i++) {\n  console.log(`${userData[i].name}'s properties are:`);\n  console.log(`  name: ${userData[i].name}`);\n  console.log(`  age: ${userData[i].age}`);\n  console.log(`  height: ${userData[i].height}`);\n}\n","path":"code/1531/24T1/1.2/object_loop2.js","fileext":"js"},"object_loop3.js":{"name":"object_loop3.js","content":"const userData = {\n  Sally: {\n    age: 18,\n    height: '186cm',\n  },\n  Bob: {\n    age: 17,\n    height: '188cm',\n  },\n};\n\nfor (const key in userData) {\n  console.log(`${key}'s properties are:`);\n  for (const key2 in userData[key]) {\n    console.log(`  ${key2}: ${userData[key][key2]}`);\n  }\n}\n","path":"code/1531/24T1/1.2/object_loop3.js","fileext":"js"},"object_model.js":{"name":"object_model.js","content":"const arr = [1, 2, 3];\nconsole.log(arr.length);\nconsole.log(arr.includes(3));\n","path":"code/1531/24T1/1.2/object_model.js","fileext":"js"},"object_more1.js":{"name":"object_more1.js","content":"// You can assign more keys even\n//  after creation\nconst userData = {\n  name: 'Sally',\n  age: 18,\n};\nuserData.height = '187cm';\n\nconsole.log(userData);\n","path":"code/1531/24T1/1.2/object_more1.js","fileext":"js"},"object_more2.js":{"name":"object_more2.js","content":"// You can reference keys with either\n//  obj.key or obj['key']\nconst userData = {};\nuserData.name = 'Sally';\nuserData.age = 18;\nuserData.height = '187cm';\nconsole.log(userData);\n","path":"code/1531/24T1/1.2/object_more2.js","fileext":"js"},"object_props_1.js":{"name":"object_props_1.js","content":"const userData = {\n  name: 'Sally',\n  age: 18,\n  height: '187cm',\n};\n\nconst keys = Object.keys(userData);\nconst entries = Object.entries(userData);\nconst values = Object.values(userData);\n\nconsole.log(keys);\nconsole.log(entries);\nconsole.log(values);\n","path":"code/1531/24T1/1.2/object_props_1.js","fileext":"js"},"object_props_2.js":{"name":"object_props_2.js","content":"const userData = {\n  name: 'Sally',\n  age: 18,\n  height: '187cm',\n};\n\nfor (const key in userData) {\n  console.log(key);\n}\n\nif ('name' in userData) {\n  console.log('Has name key');\n}\n","path":"code/1531/24T1/1.2/object_props_2.js","fileext":"js"},"objects.js":{"name":"objects.js","content":"const student = {\n  name: 'Emily',\n  score: 99,\n  rank: 1,\n};\n\nconsole.log(student);\nconsole.log(student.name);\nconsole.log(student.score);\nconsole.log(student.rank);\n\nstudent.height = 159;\nconsole.log(student);\n","path":"code/1531/24T1/1.2/objects.js","fileext":"js"},"strings.js":{"name":"strings.js","content":"// We can easily join strings together!\nlet sentence = 'My';\nsentence = sentence + ' name is';\nsentence += ' Pikachu';\nconsole.log(sentence);\n\n// If you need to mix variables and\n//  strings, you can create a string literal\nconst age = 7;\nconst name = 'Hayden';\nconst phrase = `Hello! My name is ${name} and I am ${age}`;\nconsole.log(phrase);\n","path":"code/1531/24T1/1.2/strings.js","fileext":"js"},"variables.js":{"name":"variables.js","content":"// Variables declared with \"let\"\n//  can be modified after definition\nconst years = 5;\n\n// Variables declared with \"const\"\n//  cannot be modified after definition\nconst name = 'Giraffe';\nconst age = 18;\nconst height = 2048.11;\nconst notexist = undefined;\nconst existbutnothing = null;\n\n// You print with console.log\nconsole.log(years);\nconsole.log(name);\nconsole.log(height);\n\n// Double and single apostrophes are equivalent\nconsole.log('Hello!');\nconsole.log('how are you?');\n","path":"code/1531/24T1/1.2/variables.js","fileext":"js"}}},"__N_SSG":true}