JavaScript Foundations • StreetGeek Academy
Understand how to store, access, and manipulate collections of data using arrays and objects, and use them to dynamically render portfolio content.
Arrays and objects are core data structures in JavaScript.
| Type | Structure | Best For |
|---|---|---|
| Array | Ordered list of values | Multiple items of the same kind (projects, skills) |
| Object | Key-value pairs | Describing one specific thing (a single project) |
let skills = ["HTML", "CSS", "JavaScript", "PHP"];
console.log(skills[0]); // "HTML"let project = {
title: "Portfolio Website",
tech: "HTML, CSS, JS",
year: 2025,
isPublished: true
};
console.log(project.title); // "Portfolio Website"When you combine arrays and objects, you can describe many similar items efficiently.
let projects = [
{ title: "Portfolio", tech: "HTML / CSS / JS", year: 2025 },
{ title: "WPNfinite Plugin", tech: "PHP / WordPress", year: 2024 },
{ title: "ShopBlocks WP", tech: "JS / WooCommerce", year: 2025 }
];
console.log(projects[1].title); // "WPNfinite Plugin"| Method | Purpose | Example |
|---|---|---|
.push() | Add item to end | skills.push("React") |
.pop() | Remove last item | skills.pop() |
.shift() / .unshift() | Remove / add to start | skills.unshift("Git") |
.slice(start, end) | Copy portion of array | skills.slice(1, 3) |
.indexOf("CSS") | Find position | returns 1 |
.includes("JS") | Boolean check | returns true |
.join(", ") | Turn array → string | "HTML, CSS, JS" |
| Method | What It Does |
|---|---|
.forEach() | Loop through each item (no return) |
.map() | Create a new array from each item |
.filter() | Return subset matching a condition |
.find() | Return first match |
.reduce() | Combine array into a single value |
skills.forEach(skill => console.log(skill));
let uppercaseSkills = skills.map(s => s.toUpperCase());
let jsOnly = skills.filter(s => s.includes("JS"));project.title; // Dot notation
project["year"]; // Bracket notationproject.client = "StreetGeek Academy";
project.year = 2026;const { title, year } = project;
console.log(`${title} – ${year}`);...)let extended = { ...project, rating: 5 };
console.log(extended);<ul id="skill-list"></ul>const skillList = document.getElementById("skill-list");
let skills = ["HTML", "CSS", "JavaScript", "PHP"];
skills.forEach(skill => {
let li = document.createElement("li");
li.textContent = skill;
skillList.appendChild(li);
});<section id="projects"></section>const projects = [
{ title: "Portfolio Site", tech: "HTML, CSS, JS", year: 2025 },
{ title: "ShopBlocks WP", tech: "PHP, WooCommerce", year: 2025 }
];
const section = document.getElementById("projects");
projects.forEach(p => {
const card = document.createElement("div");
card.className = "card";
card.innerHTML = `
<h3>${p.title}</h3>
<p>${p.tech}</p>
<small>${p.year}</small>
`;
section.appendChild(card);
});Add a quick filter in the console:
let recent = projects.filter(p => p.year >= 2025);
console.table(recent);Combine Module 4 and 5 concepts:
function getProjectTitles(list) {
return list.map(p => p.title);
}
console.log(getProjectTitles(projects));1) What’s the index of the first item in an array?
2) How do you add a new property to an object?
3) Which method creates a new array from each item of an existing array?
4) How would you combine two arrays into one with ES6 syntax?
5) What’s the difference between .forEach() and .map()?
Add a Dynamic Project Gallery to your portfolio using arrays + objects.
app.js, create an array of project objects:const myProjects = [
{ title: "Nfinite Dashboard", tech: "JS, CSS Grid", link: "#" },
{ title: "ShopBlocks WP", tech: "PHP, WooCommerce", link: "#" },
{ title: "BoldGrid Addon", tech: "JS, WordPress", link: "#" }
];Render them in a grid layout using forEach or map, and add a “View More” button:
const grid = document.getElementById("project-grid");
myProjects.forEach(p => {
const div = document.createElement("div");
div.className = "card";
div.innerHTML = `
<h3>${p.title}</h3>
<p>${p.tech}</p>
<button>View More</button>
`;
div.querySelector("button").addEventListener("click", () => {
console.log(`Opening ${p.title}`);
});
grid.appendChild(div);
});Next up → MODULE 6: The DOM (Document Object Model)
You’ll learn to select, create, and update HTML elements in real time — the core skill that turns your portfolio into a truly interactive web app.